diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 69611829c7ca9..c13230c3c94bf 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -64,7 +64,11 @@ pub fn expand_expr(e: @ast::Expr, fld: &mut MacroExpander) -> @ast::Expr { extnamestr.get())); // let compilation continue - return e; + return @ast::Expr { + id: ast::DUMMY_NODE_ID, + node: ast::ExprLogLevel, + span: e.span, + } } Some(&NormalTT(ref expandfun, exp_span)) => { fld.cx.bt_push(ExpnInfo { diff --git a/src/test/compile-fail/issue-11692.rs b/src/test/compile-fail/issue-11692.rs new file mode 100644 index 0000000000000..f515cc0d6e2a1 --- /dev/null +++ b/src/test/compile-fail/issue-11692.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + print!(test!()); + //~^ ERROR: macro undefined: 'test' + //~^^ ERROR: macro undefined: 'test' + //~^^^ ERROR: format argument must be a string literal + + concat!(test!()); + //~^ ERROR: macro undefined: 'test' + //~^^ ERROR: expected a literal +}