rollup merge of #21144: nagisa/asm-str-fix

Fixes #21045
This commit is contained in:
Alex Crichton 2015-01-15 14:11:55 -08:00
commit 9b7bc456ea
2 changed files with 22 additions and 0 deletions

View file

@ -63,6 +63,12 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
'statement: loop {
match state {
Asm => {
if asm_str_style.is_some() {
// If we already have a string with instructions,
// ending up in Asm state again is an error.
cx.span_err(sp, "malformed inline assembly");
return DummyResult::expr(sp);
}
let (s, style) = match expr_to_string(cx, p.parse_expr(),
"inline assembly must be a string literal") {
Some((s, st)) => (s, st),