1
Fork 0

Auto merge of #80648 - Aaron1011:expn-data-private, r=petrochenkov

Make `ExpnData` fields `krate` and `orig_id` private

These fields are only used by hygiene serialized, and should not be
accessed by anything outside of `rustc_span`.
This commit is contained in:
bors 2021-01-07 08:25:39 +00:00
commit bf5f30684a
5 changed files with 63 additions and 27 deletions

View file

@ -742,11 +742,11 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Integrator<'a, 'tcx> {
}
fn visit_span(&mut self, span: &mut Span) {
let mut expn_data =
ExpnData::default(ExpnKind::Inlined, *span, self.tcx.sess.edition(), None);
expn_data.def_site = self.body_span;
// Make sure that all spans track the fact that they were inlined.
*span = self.callsite_span.fresh_expansion(ExpnData {
def_site: self.body_span,
..ExpnData::default(ExpnKind::Inlined, *span, self.tcx.sess.edition(), None)
});
*span = self.callsite_span.fresh_expansion(expn_data);
}
fn visit_place(&mut self, place: &mut Place<'tcx>, context: PlaceContext, location: Location) {