From 31261fd629265aead5f0bdb45774067966896b1b Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Wed, 14 Jan 2015 17:02:20 +0200 Subject: Disallow a form of invalid asm! macro Fixes #21045 --- src/libsyntax/ext/asm.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/libsyntax/ext') diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs index fd3bac5b2fc..4258eb32fdf 100644 --- a/src/libsyntax/ext/asm.rs +++ b/src/libsyntax/ext/asm.rs @@ -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), -- cgit 1.4.1-3-g733a5