Avoid returning original macro if expansion fails.
Closes #11692. Instead of returning the original expression, a dummy expression (with identical span) is returned. This prevents infinite loops of failed expansions as well as odd double error messages in certain situations.
This commit is contained in:
@@ -64,7 +64,7 @@ pub fn expand_asm(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
|
||||
"inline assembly must be a string literal.") {
|
||||
Some((s, st)) => (s, st),
|
||||
// let compilation continue
|
||||
None => return MacResult::dummy_expr(),
|
||||
None => return MacResult::dummy_expr(sp),
|
||||
};
|
||||
asm = s;
|
||||
asm_str_style = Some(style);
|
||||
|
||||
Reference in New Issue
Block a user