1
Fork 0

expand: Stop un-interpolating NtIdents before passing them to built-in macros

This was a big hack, and built-in macros should be able to deal with `NtIdents` in the input by themselves like any other parser code.
This commit is contained in:
Vadim Petrochenkov 2020-09-27 19:47:52 +03:00
parent d62d3f7fa9
commit 85ef265dbe
3 changed files with 10 additions and 33 deletions

View file

@ -27,15 +27,15 @@ pub fn expand_concat_idents<'cx>(
}
}
} else {
match e {
TokenTree::Token(Token { kind: token::Ident(name, _), .. }) => {
res_str.push_str(&name.as_str())
}
_ => {
cx.span_err(sp, "concat_idents! requires ident args.");
return DummyResult::any(sp);
if let TokenTree::Token(token) = e {
if let Some((ident, _)) = token.ident() {
res_str.push_str(&ident.name.as_str());
continue;
}
}
cx.span_err(sp, "concat_idents! requires ident args.");
return DummyResult::any(sp);
}
}