use rustc_metadata::cstore::CStore;
use syntax::source_map::SourceMap;
-use syntax::ext::hygiene::{Mark, Transparency, SyntaxContext};
+use syntax::ext::hygiene::{ExpnId, Transparency, SyntaxContext};
use syntax::ast::{self, Name, NodeId, Ident, FloatTy, IntTy, UintTy};
use syntax::ext::base::SyntaxExtension;
use syntax::ext::base::MacroKind;
#[derive(Clone, Debug)]
pub struct ParentScope<'a> {
module: Module<'a>,
- expansion: Mark,
+ expansion: ExpnId,
legacy: LegacyScope<'a>,
derives: Vec<ast::Path>,
}
builtin_attrs: RefCell<Vec<(Ident, ParentScope<'a>)>>,
// Macro invocations that can expand into items in this module.
- unresolved_invocations: RefCell<FxHashSet<Mark>>,
+ unresolved_invocations: RefCell<FxHashSet<ExpnId>>,
no_implicit_prelude: bool,
/// Span of the module itself. Used for error reporting.
span: Span,
- expansion: Mark,
+ expansion: ExpnId,
}
type Module<'a> = &'a ModuleData<'a>;
fn new(parent: Option<Module<'a>>,
kind: ModuleKind,
normal_ancestor_id: DefId,
- expansion: Mark,
+ expansion: ExpnId,
span: Span) -> Self {
ModuleData {
parent,
pub struct NameBinding<'a> {
kind: NameBindingKind<'a>,
ambiguity: Option<(&'a NameBinding<'a>, AmbiguityKind)>,
- expansion: Mark,
+ expansion: ExpnId,
span: Span,
vis: ty::Visibility,
}
// in some later round and screw up our previously found resolution.
// See more detailed explanation in
// https://github.com/rust-lang/rust/pull/53778#issuecomment-419224049
- fn may_appear_after(&self, invoc_parent_expansion: Mark, binding: &NameBinding<'_>) -> bool {
+ fn may_appear_after(&self, invoc_parent_expansion: ExpnId, binding: &NameBinding<'_>) -> bool {
// self > max(invoc, binding) => !(self <= invoc || self <= binding)
// Expansions are partially ordered, so "may appear after" is an inversion of
// "certainly appears before or simultaneously" and includes unordered cases.
dummy_ext_bang: Lrc<SyntaxExtension>,
dummy_ext_derive: Lrc<SyntaxExtension>,
non_macro_attrs: [Lrc<SyntaxExtension>; 2],
- macro_defs: FxHashMap<Mark, DefId>,
+ macro_defs: FxHashMap<ExpnId, DefId>,
local_macro_def_scopes: FxHashMap<NodeId, Module<'a>>,
unused_macros: NodeMap<Span>,
proc_macro_stubs: NodeSet,
- /// Maps the `Mark` of an expansion to its containing module or block.
- invocations: FxHashMap<Mark, &'a InvocationData<'a>>,
+ /// Maps the `ExpnId` of an expansion to its containing module or block.
+ invocations: FxHashMap<ExpnId, &'a InvocationData<'a>>,
/// Avoid duplicated errors for "name already defined".
name_already_seen: FxHashMap<Name, Span>,
);
let graph_root = arenas.alloc_module(ModuleData {
no_implicit_prelude: attr::contains_name(&krate.attrs, sym::no_implicit_prelude),
- ..ModuleData::new(None, root_module_kind, root_def_id, Mark::root(), krate.span)
+ ..ModuleData::new(None, root_module_kind, root_def_id, ExpnId::root(), krate.span)
});
let mut module_map = FxHashMap::default();
module_map.insert(DefId::local(CRATE_DEF_INDEX), graph_root);
}
let mut invocations = FxHashMap::default();
- invocations.insert(Mark::root(),
+ invocations.insert(ExpnId::root(),
arenas.alloc_invocation_data(InvocationData::root(graph_root)));
let mut macro_defs = FxHashMap::default();
- macro_defs.insert(Mark::root(), root_def_id);
+ macro_defs.insert(ExpnId::root(), root_def_id);
let features = session.features_untracked();
let non_macro_attr =
dummy_binding: arenas.alloc_name_binding(NameBinding {
kind: NameBindingKind::Res(Res::Err, false),
ambiguity: None,
- expansion: Mark::root(),
+ expansion: ExpnId::root(),
span: DUMMY_SP,
vis: ty::Visibility::Public,
}),
parent: Module<'a>,
kind: ModuleKind,
normal_ancestor_id: DefId,
- expansion: Mark,
+ expansion: ExpnId,
span: Span,
) -> Module<'a> {
let module = ModuleData::new(Some(parent), kind, normal_ancestor_id, expansion, span);
}
Scope::CrateRoot => match ns {
TypeNS => {
- ident.span.adjust(Mark::root());
+ ident.span.adjust(ExpnId::root());
Scope::ExternPrelude
}
ValueNS | MacroNS => break,
match self.hygienic_lexical_parent(module, &mut ident.span) {
Some(parent_module) => Scope::Module(parent_module),
None => {
- ident.span.adjust(Mark::root());
+ ident.span.adjust(ExpnId::root());
match ns {
TypeNS => Scope::ExternPrelude,
ValueNS => Scope::StdLibPrelude,
}
if !module.no_implicit_prelude {
- ident.span.adjust(Mark::root());
+ ident.span.adjust(ExpnId::root());
if ns == TypeNS {
if let Some(binding) = self.extern_prelude_get(ident, !record_used) {
return Some(LexicalScopeBinding::Item(binding));
}
if ns == TypeNS && KNOWN_TOOLS.contains(&ident.name) {
let binding = (Res::ToolMod, ty::Visibility::Public,
- DUMMY_SP, Mark::root()).to_name_binding(self.arenas);
+ DUMMY_SP, ExpnId::root()).to_name_binding(self.arenas);
return Some(LexicalScopeBinding::Item(binding));
}
if let Some(prelude) = self.prelude {
}
}
ModuleOrUniformRoot::ExternPrelude => {
- ident.span.modernize_and_adjust(Mark::root());
+ ident.span.modernize_and_adjust(ExpnId::root());
}
ModuleOrUniformRoot::CrateRootAndExternPrelude |
ModuleOrUniformRoot::CurrentScope => {
result
} else {
ctxt = ctxt.modern();
- ctxt.adjust(Mark::root())
+ ctxt.adjust(ExpnId::root())
};
let module = match mark {
Some(def) => self.macro_def_scope(def),
};
let crate_root = self.get_module(DefId { krate: crate_id, index: CRATE_DEF_INDEX });
self.populate_module_if_necessary(&crate_root);
- Some((crate_root, ty::Visibility::Public, DUMMY_SP, Mark::root())
+ Some((crate_root, ty::Visibility::Public, DUMMY_SP, ExpnId::root())
.to_name_binding(self.arenas))
}
})