about summary refs log tree commit diff
path: root/compiler/rustc_expand/src
diff options
context:
space:
mode:
authorThe 8472 <git@infinite-source.de>2023-07-02 22:43:39 +0200
committerThe 8472 <git@infinite-source.de>2023-07-03 13:29:15 +0200
commit14e57d7c134cc80878c10f2e2bb61e62cc6a2fdb (patch)
treeb970f018ef5091a430589e8c2a1c152252d4df18 /compiler/rustc_expand/src
parent6162f6f12339aa81fe16b8a64644ead497e411b2 (diff)
downloadrust-14e57d7c134cc80878c10f2e2bb61e62cc6a2fdb.tar.gz
rust-14e57d7c134cc80878c10f2e2bb61e62cc6a2fdb.zip
perform TokenStream replacement in-place when possible in expand_macro
Diffstat (limited to 'compiler/rustc_expand/src')
-rw-r--r--compiler/rustc_expand/src/mbe/macro_rules.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/compiler/rustc_expand/src/mbe/macro_rules.rs b/compiler/rustc_expand/src/mbe/macro_rules.rs
index 4a8a14994ff..42cc0a6b143 100644
--- a/compiler/rustc_expand/src/mbe/macro_rules.rs
+++ b/compiler/rustc_expand/src/mbe/macro_rules.rs
@@ -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) {