about summary refs log tree commit diff
path: root/compiler/rustc_span/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-07-14 01:41:12 +0000
committerbors <bors@rust-lang.org>2021-07-14 01:41:12 +0000
commit2155386f319d1d17b7b1604a2d6401c98decce9b (patch)
tree77570a43561de7f88367aa8482f67cb244c2e1e5 /compiler/rustc_span/src
parentc7d6bcc788ef6b2293d2d5166a9b0339d5d03b0a (diff)
parent7d373c9c11a63714a1dd9ce79d38a088a435723d (diff)
downloadrust-2155386f319d1d17b7b1604a2d6401c98decce9b.tar.gz
rust-2155386f319d1d17b7b1604a2d6401c98decce9b.zip
Auto merge of #87106 - Mark-Simulacrum:edition-no-clone, r=petrochenkov
Avoid cloning ExpnData to access Span edition

ExpnData is a fairly hefty structure to clone; cloning it may not be cheap. In
some cases this may get optimized out, but it's not clear that will always be
the case. Try to avoid that cost.

r? `@ghost` -- opening for a perf run to start with
Diffstat (limited to 'compiler/rustc_span/src')
-rw-r--r--compiler/rustc_span/src/hygiene.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_span/src/hygiene.rs b/compiler/rustc_span/src/hygiene.rs
index 9a101169d20..d292f652896 100644
--- a/compiler/rustc_span/src/hygiene.rs
+++ b/compiler/rustc_span/src/hygiene.rs
@@ -670,7 +670,7 @@ impl SyntaxContext {
     }
 
     pub fn edition(self) -> Edition {
-        self.outer_expn_data().edition
+        HygieneData::with(|data| data.expn_data(data.outer_expn(self)).edition)
     }
 }