Skip to content

Commit

Permalink
Avoid cloning ExpnData to access Span edition
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Mark-Simulacrum committed Jul 13, 2021
1 parent 81053b9 commit 7d373c9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/rustc_span/src/hygiene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ impl SyntaxContext {
}

pub fn edition(self) -> Edition {
self.outer_expn_data().edition
HygieneData::with(|data| data.expn_data(data.outer_expn(self)).edition)
}
}

Expand Down

0 comments on commit 7d373c9

Please sign in to comment.