about summary refs log tree commit diff
path: root/compiler/rustc_expand/src/mbe
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2024-03-03 15:34:22 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2024-06-10 02:20:16 +0300
commitd5dd2d8284c30f3f79e4beb35246761ed4892c49 (patch)
treeae670bd652137dd07dfca5d548aad3697e50c7dc /compiler/rustc_expand/src/mbe
parenta70b2ae57713ed0e7411c059d582ab382fc4166a (diff)
downloadrust-d5dd2d8284c30f3f79e4beb35246761ed4892c49.tar.gz
rust-d5dd2d8284c30f3f79e4beb35246761ed4892c49.zip
rustc_span: Optimize syntax context updates in spans
Diffstat (limited to 'compiler/rustc_expand/src/mbe')
-rw-r--r--compiler/rustc_expand/src/mbe/transcribe.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_expand/src/mbe/transcribe.rs b/compiler/rustc_expand/src/mbe/transcribe.rs
index 3196b826085..25e961d6009 100644
--- a/compiler/rustc_expand/src/mbe/transcribe.rs
+++ b/compiler/rustc_expand/src/mbe/transcribe.rs
@@ -30,11 +30,11 @@ impl MutVisitor for Marker {
         // it's some advanced case with macro-generated macros. So if we cache the marked version
         // of that context once, we'll typically have a 100% cache hit rate after that.
         let Marker(expn_id, transparency, ref mut cache) = *self;
-        let data = span.data();
-        let marked_ctxt = *cache
-            .entry(data.ctxt)
-            .or_insert_with(|| data.ctxt.apply_mark(expn_id.to_expn_id(), transparency));
-        *span = data.with_ctxt(marked_ctxt);
+        span.update_ctxt(|ctxt| {
+            *cache
+                .entry(ctxt)
+                .or_insert_with(|| ctxt.apply_mark(expn_id.to_expn_id(), transparency))
+        });
     }
 }