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:
@@ -21,7 +21,7 @@ pub fn expand_syntax_ext(cx: &mut base::ExtCtxt,
|
||||
tts: &[ast::TokenTree]) -> base::MacResult {
|
||||
let es = match base::get_exprs_from_tts(cx, sp, tts) {
|
||||
Some(e) => e,
|
||||
None => return base::MacResult::dummy_expr()
|
||||
None => return base::MacResult::dummy_expr(sp)
|
||||
};
|
||||
let mut accumulator = ~"";
|
||||
for e in es.move_iter() {
|
||||
|
||||
Reference in New Issue
Block a user