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:
Aaron Hill
2021-01-03 08:56:49 -05:00
parent 18cb4ad3b9
commit 21b8f2ecde
5 changed files with 63 additions and 27 deletions

View File

@@ -1020,15 +1020,16 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
// with exception of the derive container case which is not resolved and can get
// its expansion data immediately.
let expn_data = match &kind {
InvocationKind::DeriveContainer { item, .. } => Some(ExpnData {
parent: self.cx.current_expansion.id,
..ExpnData::default(
InvocationKind::DeriveContainer { item, .. } => {
let mut expn_data = ExpnData::default(
ExpnKind::Macro(MacroKind::Attr, sym::derive),
item.span(),
self.cx.sess.parse_sess.edition,
None,
)
}),
);
expn_data.parent = self.cx.current_expansion.id;
Some(expn_data)
}
_ => None,
};
let expn_id = ExpnId::fresh(expn_data);