perform TokenStream replacement in-place when possible in expand_macro
This commit is contained in:
parent
6162f6f123
commit
14e57d7c13
2 changed files with 19 additions and 5 deletions
|
@ -223,8 +223,7 @@ fn expand_macro<'cx>(
|
|||
// Replace all the tokens for the corresponding positions in the macro, to maintain
|
||||
// proper positions in error reporting, while maintaining the macro_backtrace.
|
||||
if tts.len() == rhs.tts.len() {
|
||||
tts = tts.map_enumerated(|i, tt| {
|
||||
let mut tt = tt.clone();
|
||||
tts = tts.map_enumerated_owned(|i, mut tt| {
|
||||
let rhs_tt = &rhs.tts[i];
|
||||
let ctxt = tt.span().ctxt();
|
||||
match (&mut tt, rhs_tt) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue