Skip to content

Commit 7d373c9

Browse files
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.
1 parent 81053b9 commit 7d373c9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/rustc_span/src/hygiene.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ impl SyntaxContext {
644644
}
645645

646646
pub fn edition(self) -> Edition {
647-
self.outer_expn_data().edition
647+
HygieneData::with(|data| data.expn_data(data.outer_expn(self)).edition)
648648
}
649649
}
650650

0 commit comments

Comments
 (0)