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:
parent
18cb4ad3b9
commit
21b8f2ecde
5 changed files with 63 additions and 27 deletions
|
@ -12,7 +12,7 @@ use rustc_data_structures::sync::{self, Lrc};
|
|||
use rustc_errors::{DiagnosticBuilder, ErrorReported};
|
||||
use rustc_parse::{self, nt_to_tokenstream, parser, MACRO_ARGUMENTS};
|
||||
use rustc_session::{parse::ParseSess, Limit, Session};
|
||||
use rustc_span::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc_span::def_id::DefId;
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::hygiene::{AstPass, ExpnData, ExpnId, ExpnKind};
|
||||
use rustc_span::source_map::SourceMap;
|
||||
|
@ -842,19 +842,17 @@ impl SyntaxExtension {
|
|||
descr: Symbol,
|
||||
macro_def_id: Option<DefId>,
|
||||
) -> ExpnData {
|
||||
ExpnData {
|
||||
kind: ExpnKind::Macro(self.macro_kind(), descr),
|
||||
ExpnData::new(
|
||||
ExpnKind::Macro(self.macro_kind(), descr),
|
||||
parent,
|
||||
call_site,
|
||||
def_site: self.span,
|
||||
allow_internal_unstable: self.allow_internal_unstable.clone(),
|
||||
allow_internal_unsafe: self.allow_internal_unsafe,
|
||||
local_inner_macros: self.local_inner_macros,
|
||||
edition: self.edition,
|
||||
self.span,
|
||||
self.allow_internal_unstable.clone(),
|
||||
self.allow_internal_unsafe,
|
||||
self.local_inner_macros,
|
||||
self.edition,
|
||||
macro_def_id,
|
||||
krate: LOCAL_CRATE,
|
||||
orig_id: None,
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue