libsyntax: Remove Mark into ExpnId
This commit is contained in:
parent
f9477a77c5
commit
31e10aec83
23 changed files with 183 additions and 182 deletions
|
|
@ -30,7 +30,7 @@ use syntax::attr;
|
|||
use syntax::ast::{self, Block, ForeignItem, ForeignItemKind, Item, ItemKind, NodeId};
|
||||
use syntax::ast::{MetaItemKind, StmtKind, TraitItem, TraitItemKind, Variant};
|
||||
use syntax::ext::base::SyntaxExtension;
|
||||
use syntax::ext::hygiene::Mark;
|
||||
use syntax::ext::hygiene::ExpnId;
|
||||
use syntax::ext::tt::macro_rules;
|
||||
use syntax::feature_gate::is_builtin_attr;
|
||||
use syntax::parse::token::{self, Token};
|
||||
|
|
@ -45,7 +45,7 @@ use log::debug;
|
|||
|
||||
type Res = def::Res<NodeId>;
|
||||
|
||||
impl<'a> ToNameBinding<'a> for (Module<'a>, ty::Visibility, Span, Mark) {
|
||||
impl<'a> ToNameBinding<'a> for (Module<'a>, ty::Visibility, Span, ExpnId) {
|
||||
fn to_name_binding(self, arenas: &'a ResolverArenas<'a>) -> &'a NameBinding<'a> {
|
||||
arenas.alloc_name_binding(NameBinding {
|
||||
kind: NameBindingKind::Module(self.0),
|
||||
|
|
@ -57,7 +57,7 @@ impl<'a> ToNameBinding<'a> for (Module<'a>, ty::Visibility, Span, Mark) {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> ToNameBinding<'a> for (Res, ty::Visibility, Span, Mark) {
|
||||
impl<'a> ToNameBinding<'a> for (Res, ty::Visibility, Span, ExpnId) {
|
||||
fn to_name_binding(self, arenas: &'a ResolverArenas<'a>) -> &'a NameBinding<'a> {
|
||||
arenas.alloc_name_binding(NameBinding {
|
||||
kind: NameBindingKind::Res(self.0, false),
|
||||
|
|
@ -71,7 +71,7 @@ impl<'a> ToNameBinding<'a> for (Res, ty::Visibility, Span, Mark) {
|
|||
|
||||
pub(crate) struct IsMacroExport;
|
||||
|
||||
impl<'a> ToNameBinding<'a> for (Res, ty::Visibility, Span, Mark, IsMacroExport) {
|
||||
impl<'a> ToNameBinding<'a> for (Res, ty::Visibility, Span, ExpnId, IsMacroExport) {
|
||||
fn to_name_binding(self, arenas: &'a ResolverArenas<'a>) -> &'a NameBinding<'a> {
|
||||
arenas.alloc_name_binding(NameBinding {
|
||||
kind: NameBindingKind::Res(self.0, true),
|
||||
|
|
@ -397,7 +397,7 @@ impl<'a> Resolver<'a> {
|
|||
let imported_binding = self.import(binding, directive);
|
||||
if ptr::eq(self.current_module, self.graph_root) {
|
||||
if let Some(entry) = self.extern_prelude.get(&ident.modern()) {
|
||||
if expansion != Mark::root() && orig_name.is_some() &&
|
||||
if expansion != ExpnId::root() && orig_name.is_some() &&
|
||||
entry.extern_crate_item.is_none() {
|
||||
self.session.span_err(item.span, "macro-expanded `extern crate` items \
|
||||
cannot shadow names passed with \
|
||||
|
|
@ -571,7 +571,7 @@ impl<'a> Resolver<'a> {
|
|||
variant: &Variant,
|
||||
parent: Module<'a>,
|
||||
vis: ty::Visibility,
|
||||
expansion: Mark) {
|
||||
expansion: ExpnId) {
|
||||
let ident = variant.node.ident;
|
||||
|
||||
// Define a name in the type namespace.
|
||||
|
|
@ -600,7 +600,7 @@ impl<'a> Resolver<'a> {
|
|||
}
|
||||
|
||||
/// Constructs the reduced graph for one foreign item.
|
||||
fn build_reduced_graph_for_foreign_item(&mut self, item: &ForeignItem, expansion: Mark) {
|
||||
fn build_reduced_graph_for_foreign_item(&mut self, item: &ForeignItem, expansion: ExpnId) {
|
||||
let (res, ns) = match item.node {
|
||||
ForeignItemKind::Fn(..) => {
|
||||
(Res::Def(DefKind::Fn, self.definitions.local_def_id(item.id)), ValueNS)
|
||||
|
|
@ -618,7 +618,7 @@ impl<'a> Resolver<'a> {
|
|||
self.define(parent, item.ident, ns, (res, vis, item.span, expansion));
|
||||
}
|
||||
|
||||
fn build_reduced_graph_for_block(&mut self, block: &Block, expansion: Mark) {
|
||||
fn build_reduced_graph_for_block(&mut self, block: &Block, expansion: ExpnId) {
|
||||
let parent = self.current_module;
|
||||
if self.block_needs_anonymous_module(block) {
|
||||
let module = self.new_module(parent,
|
||||
|
|
@ -642,7 +642,7 @@ impl<'a> Resolver<'a> {
|
|||
// but metadata cannot encode gensyms currently, so we create it here.
|
||||
// This is only a guess, two equivalent idents may incorrectly get different gensyms here.
|
||||
let ident = ident.gensym_if_underscore();
|
||||
let expansion = Mark::root(); // FIXME(jseyfried) intercrate hygiene
|
||||
let expansion = ExpnId::root(); // FIXME(jseyfried) intercrate hygiene
|
||||
match res {
|
||||
Res::Def(kind @ DefKind::Mod, def_id)
|
||||
| Res::Def(kind @ DefKind::Enum, def_id) => {
|
||||
|
|
@ -734,13 +734,14 @@ impl<'a> Resolver<'a> {
|
|||
};
|
||||
|
||||
let kind = ModuleKind::Def(DefKind::Mod, def_id, name.as_symbol());
|
||||
let module =
|
||||
self.arenas.alloc_module(ModuleData::new(parent, kind, def_id, Mark::root(), DUMMY_SP));
|
||||
let module = self.arenas.alloc_module(ModuleData::new(
|
||||
parent, kind, def_id, ExpnId::root(), DUMMY_SP
|
||||
));
|
||||
self.extern_module_map.insert((def_id, macros_only), module);
|
||||
module
|
||||
}
|
||||
|
||||
pub fn macro_def_scope(&mut self, expansion: Mark) -> Module<'a> {
|
||||
pub fn macro_def_scope(&mut self, expansion: ExpnId) -> Module<'a> {
|
||||
let def_id = match self.macro_defs.get(&expansion) {
|
||||
Some(def_id) => *def_id,
|
||||
None => return self.graph_root,
|
||||
|
|
@ -858,7 +859,7 @@ impl<'a> Resolver<'a> {
|
|||
used: Cell::new(false),
|
||||
});
|
||||
|
||||
let allow_shadowing = parent_scope.expansion == Mark::root();
|
||||
let allow_shadowing = parent_scope.expansion == ExpnId::root();
|
||||
if let Some(span) = import_all {
|
||||
let directive = macro_use_directive(span);
|
||||
self.potentially_unused_imports.push(directive);
|
||||
|
|
@ -918,7 +919,7 @@ impl<'a> Resolver<'a> {
|
|||
pub struct BuildReducedGraphVisitor<'a, 'b> {
|
||||
pub resolver: &'a mut Resolver<'b>,
|
||||
pub current_legacy_scope: LegacyScope<'b>,
|
||||
pub expansion: Mark,
|
||||
pub expansion: ExpnId,
|
||||
}
|
||||
|
||||
impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ use rustc_metadata::creader::CrateLoader;
|
|||
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;
|
||||
|
|
@ -141,7 +141,7 @@ enum ScopeSet {
|
|||
#[derive(Clone, Debug)]
|
||||
pub struct ParentScope<'a> {
|
||||
module: Module<'a>,
|
||||
expansion: Mark,
|
||||
expansion: ExpnId,
|
||||
legacy: LegacyScope<'a>,
|
||||
derives: Vec<ast::Path>,
|
||||
}
|
||||
|
|
@ -1178,7 +1178,7 @@ pub struct ModuleData<'a> {
|
|||
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,
|
||||
|
||||
|
|
@ -1196,7 +1196,7 @@ pub struct ModuleData<'a> {
|
|||
/// Span of the module itself. Used for error reporting.
|
||||
span: Span,
|
||||
|
||||
expansion: Mark,
|
||||
expansion: ExpnId,
|
||||
}
|
||||
|
||||
type Module<'a> = &'a ModuleData<'a>;
|
||||
|
|
@ -1205,7 +1205,7 @@ impl<'a> ModuleData<'a> {
|
|||
fn new(parent: Option<Module<'a>>,
|
||||
kind: ModuleKind,
|
||||
normal_ancestor_id: DefId,
|
||||
expansion: Mark,
|
||||
expansion: ExpnId,
|
||||
span: Span) -> Self {
|
||||
ModuleData {
|
||||
parent,
|
||||
|
|
@ -1304,7 +1304,7 @@ impl<'a> fmt::Debug for ModuleData<'a> {
|
|||
pub struct NameBinding<'a> {
|
||||
kind: NameBindingKind<'a>,
|
||||
ambiguity: Option<(&'a NameBinding<'a>, AmbiguityKind)>,
|
||||
expansion: Mark,
|
||||
expansion: ExpnId,
|
||||
span: Span,
|
||||
vis: ty::Visibility,
|
||||
}
|
||||
|
|
@ -1513,7 +1513,7 @@ impl<'a> NameBinding<'a> {
|
|||
// 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.
|
||||
|
|
@ -1686,13 +1686,13 @@ pub struct Resolver<'a> {
|
|||
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>,
|
||||
|
|
@ -1918,7 +1918,7 @@ impl<'a> Resolver<'a> {
|
|||
);
|
||||
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);
|
||||
|
|
@ -1941,11 +1941,11 @@ impl<'a> Resolver<'a> {
|
|||
}
|
||||
|
||||
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 =
|
||||
|
|
@ -2014,7 +2014,7 @@ impl<'a> Resolver<'a> {
|
|||
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,
|
||||
}),
|
||||
|
|
@ -2095,7 +2095,7 @@ impl<'a> Resolver<'a> {
|
|||
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);
|
||||
|
|
@ -2243,7 +2243,7 @@ impl<'a> Resolver<'a> {
|
|||
}
|
||||
Scope::CrateRoot => match ns {
|
||||
TypeNS => {
|
||||
ident.span.adjust(Mark::root());
|
||||
ident.span.adjust(ExpnId::root());
|
||||
Scope::ExternPrelude
|
||||
}
|
||||
ValueNS | MacroNS => break,
|
||||
|
|
@ -2253,7 +2253,7 @@ impl<'a> Resolver<'a> {
|
|||
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,
|
||||
|
|
@ -2399,7 +2399,7 @@ impl<'a> Resolver<'a> {
|
|||
}
|
||||
|
||||
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));
|
||||
|
|
@ -2407,7 +2407,7 @@ impl<'a> Resolver<'a> {
|
|||
}
|
||||
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 {
|
||||
|
|
@ -2506,7 +2506,7 @@ impl<'a> Resolver<'a> {
|
|||
}
|
||||
}
|
||||
ModuleOrUniformRoot::ExternPrelude => {
|
||||
ident.span.modernize_and_adjust(Mark::root());
|
||||
ident.span.modernize_and_adjust(ExpnId::root());
|
||||
}
|
||||
ModuleOrUniformRoot::CrateRootAndExternPrelude |
|
||||
ModuleOrUniformRoot::CurrentScope => {
|
||||
|
|
@ -2552,7 +2552,7 @@ impl<'a> Resolver<'a> {
|
|||
result
|
||||
} else {
|
||||
ctxt = ctxt.modern();
|
||||
ctxt.adjust(Mark::root())
|
||||
ctxt.adjust(ExpnId::root())
|
||||
};
|
||||
let module = match mark {
|
||||
Some(def) => self.macro_def_scope(def),
|
||||
|
|
@ -5063,7 +5063,7 @@ impl<'a> Resolver<'a> {
|
|||
};
|
||||
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))
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use syntax::attr::{self, StabilityLevel};
|
|||
use syntax::ext::base::{self, Indeterminate};
|
||||
use syntax::ext::base::{MacroKind, SyntaxExtension};
|
||||
use syntax::ext::expand::{AstFragment, Invocation, InvocationKind};
|
||||
use syntax::ext::hygiene::{self, Mark, ExpnInfo, ExpnKind};
|
||||
use syntax::ext::hygiene::{self, ExpnId, ExpnInfo, ExpnKind};
|
||||
use syntax::ext::tt::macro_rules;
|
||||
use syntax::feature_gate::{emit_feature_err, is_builtin_attr_name};
|
||||
use syntax::feature_gate::GateIssue;
|
||||
|
|
@ -135,8 +135,8 @@ impl<'a> base::Resolver for Resolver<'a> {
|
|||
self.session.next_node_id()
|
||||
}
|
||||
|
||||
fn get_module_scope(&mut self, id: ast::NodeId) -> Mark {
|
||||
let span = DUMMY_SP.fresh_expansion(Mark::root(), ExpnInfo::default(
|
||||
fn get_module_scope(&mut self, id: ast::NodeId) -> ExpnId {
|
||||
let span = DUMMY_SP.fresh_expansion(ExpnId::root(), ExpnInfo::default(
|
||||
ExpnKind::Macro(MacroKind::Attr, sym::test_case), DUMMY_SP, self.session.edition()
|
||||
));
|
||||
let mark = span.ctxt().outer();
|
||||
|
|
@ -160,8 +160,8 @@ impl<'a> base::Resolver for Resolver<'a> {
|
|||
});
|
||||
}
|
||||
|
||||
fn visit_ast_fragment_with_placeholders(&mut self, mark: Mark, fragment: &AstFragment,
|
||||
derives: &[Mark]) {
|
||||
fn visit_ast_fragment_with_placeholders(&mut self, mark: ExpnId, fragment: &AstFragment,
|
||||
derives: &[ExpnId]) {
|
||||
fragment.visit_with(&mut DefCollector::new(&mut self.definitions, mark));
|
||||
|
||||
let invocation = self.invocations[&mark];
|
||||
|
|
@ -194,7 +194,7 @@ impl<'a> base::Resolver for Resolver<'a> {
|
|||
ambiguity: None,
|
||||
span: DUMMY_SP,
|
||||
vis: ty::Visibility::Public,
|
||||
expansion: Mark::root(),
|
||||
expansion: ExpnId::root(),
|
||||
});
|
||||
if self.builtin_macros.insert(ident.name, binding).is_some() {
|
||||
self.session.span_err(ident.span,
|
||||
|
|
@ -206,7 +206,7 @@ impl<'a> base::Resolver for Resolver<'a> {
|
|||
ImportResolver { resolver: self }.resolve_imports()
|
||||
}
|
||||
|
||||
fn resolve_macro_invocation(&mut self, invoc: &Invocation, invoc_id: Mark, force: bool)
|
||||
fn resolve_macro_invocation(&mut self, invoc: &Invocation, invoc_id: ExpnId, force: bool)
|
||||
-> Result<Option<Lrc<SyntaxExtension>>, Indeterminate> {
|
||||
let (path, kind, derives_in_scope, after_derive) = match invoc.kind {
|
||||
InvocationKind::Attr { ref attr, ref derives, after_derive, .. } =>
|
||||
|
|
@ -250,10 +250,10 @@ impl<'a> base::Resolver for Resolver<'a> {
|
|||
|
||||
impl<'a> Resolver<'a> {
|
||||
pub fn dummy_parent_scope(&self) -> ParentScope<'a> {
|
||||
self.invoc_parent_scope(Mark::root(), Vec::new())
|
||||
self.invoc_parent_scope(ExpnId::root(), Vec::new())
|
||||
}
|
||||
|
||||
fn invoc_parent_scope(&self, invoc_id: Mark, derives: Vec<ast::Path>) -> ParentScope<'a> {
|
||||
fn invoc_parent_scope(&self, invoc_id: ExpnId, derives: Vec<ast::Path>) -> ParentScope<'a> {
|
||||
let invoc = self.invocations[&invoc_id];
|
||||
ParentScope {
|
||||
module: invoc.module.nearest_item_scope(),
|
||||
|
|
@ -460,7 +460,7 @@ impl<'a> Resolver<'a> {
|
|||
&parent_scope, true, force) {
|
||||
Ok((Some(ext), _)) => if ext.helper_attrs.contains(&ident.name) {
|
||||
let binding = (Res::NonMacroAttr(NonMacroAttrKind::DeriveHelper),
|
||||
ty::Visibility::Public, derive.span, Mark::root())
|
||||
ty::Visibility::Public, derive.span, ExpnId::root())
|
||||
.to_name_binding(this.arenas);
|
||||
result = Ok((binding, Flags::empty()));
|
||||
break;
|
||||
|
|
@ -541,7 +541,7 @@ impl<'a> Resolver<'a> {
|
|||
}
|
||||
Scope::BuiltinAttrs => if is_builtin_attr_name(ident.name) {
|
||||
let binding = (Res::NonMacroAttr(NonMacroAttrKind::Builtin),
|
||||
ty::Visibility::Public, DUMMY_SP, Mark::root())
|
||||
ty::Visibility::Public, DUMMY_SP, ExpnId::root())
|
||||
.to_name_binding(this.arenas);
|
||||
Ok((binding, Flags::PRELUDE))
|
||||
} else {
|
||||
|
|
@ -550,7 +550,7 @@ impl<'a> Resolver<'a> {
|
|||
Scope::LegacyPluginHelpers => if this.session.plugin_attributes.borrow().iter()
|
||||
.any(|(name, _)| ident.name == *name) {
|
||||
let binding = (Res::NonMacroAttr(NonMacroAttrKind::LegacyPluginHelper),
|
||||
ty::Visibility::Public, DUMMY_SP, Mark::root())
|
||||
ty::Visibility::Public, DUMMY_SP, ExpnId::root())
|
||||
.to_name_binding(this.arenas);
|
||||
Ok((binding, Flags::PRELUDE))
|
||||
} else {
|
||||
|
|
@ -563,7 +563,7 @@ impl<'a> Resolver<'a> {
|
|||
)),
|
||||
}
|
||||
Scope::ToolPrelude => if KNOWN_TOOLS.contains(&ident.name) {
|
||||
let binding = (Res::ToolMod, ty::Visibility::Public, DUMMY_SP, Mark::root())
|
||||
let binding = (Res::ToolMod, ty::Visibility::Public, DUMMY_SP, ExpnId::root())
|
||||
.to_name_binding(this.arenas);
|
||||
Ok((binding, Flags::PRELUDE))
|
||||
} else {
|
||||
|
|
@ -588,7 +588,7 @@ impl<'a> Resolver<'a> {
|
|||
.get(&ident.name).cloned() {
|
||||
Some(prim_ty) => {
|
||||
let binding = (Res::PrimTy(prim_ty), ty::Visibility::Public,
|
||||
DUMMY_SP, Mark::root()).to_name_binding(this.arenas);
|
||||
DUMMY_SP, ExpnId::root()).to_name_binding(this.arenas);
|
||||
Ok((binding, Flags::PRELUDE))
|
||||
}
|
||||
None => Err(Determinacy::Determined)
|
||||
|
|
@ -688,7 +688,7 @@ impl<'a> Resolver<'a> {
|
|||
// the last segment, so we are certainly working with a single-segment attribute here.)
|
||||
assert!(ns == MacroNS);
|
||||
let binding = (Res::NonMacroAttr(NonMacroAttrKind::Custom),
|
||||
ty::Visibility::Public, orig_ident.span, Mark::root())
|
||||
ty::Visibility::Public, orig_ident.span, ExpnId::root())
|
||||
.to_name_binding(self.arenas);
|
||||
Ok(binding)
|
||||
} else {
|
||||
|
|
@ -846,7 +846,7 @@ impl<'a> Resolver<'a> {
|
|||
|
||||
pub fn define_macro(&mut self,
|
||||
item: &ast::Item,
|
||||
expansion: Mark,
|
||||
expansion: ExpnId,
|
||||
current_legacy_scope: &mut LegacyScope<'a>) {
|
||||
let (ext, ident, span, is_legacy) = match &item.node {
|
||||
ItemKind::MacroDef(def) => {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ use rustc::util::nodemap::FxHashSet;
|
|||
use rustc::{bug, span_bug};
|
||||
|
||||
use syntax::ast::{self, Ident, Name, NodeId, CRATE_NODE_ID};
|
||||
use syntax::ext::hygiene::Mark;
|
||||
use syntax::ext::hygiene::ExpnId;
|
||||
use syntax::symbol::kw;
|
||||
use syntax::util::lev_distance::find_best_match_for_name;
|
||||
use syntax::{struct_span_err, unwrap_or};
|
||||
|
|
@ -221,7 +221,7 @@ impl<'a> Resolver<'a> {
|
|||
ident.name == kw::DollarCrate {
|
||||
let module = self.resolve_crate_root(ident);
|
||||
let binding = (module, ty::Visibility::Public,
|
||||
module.span, Mark::root())
|
||||
module.span, ExpnId::root())
|
||||
.to_name_binding(self.arenas);
|
||||
return Ok(binding);
|
||||
} else if ident.name == kw::Super ||
|
||||
|
|
@ -246,7 +246,7 @@ impl<'a> Resolver<'a> {
|
|||
.map_err(|_| (Determined, Weak::No))?; // This happens when there is a cycle of imports.
|
||||
|
||||
if let Some(binding) = resolution.binding {
|
||||
if !restricted_shadowing && binding.expansion != Mark::root() {
|
||||
if !restricted_shadowing && binding.expansion != ExpnId::root() {
|
||||
if let NameBindingKind::Res(_, true) = binding.kind {
|
||||
self.macro_expanded_macro_export_errors.insert((path_span, binding.span));
|
||||
}
|
||||
|
|
@ -286,7 +286,7 @@ impl<'a> Resolver<'a> {
|
|||
if let Some(shadowed_glob) = resolution.shadowed_glob {
|
||||
// Forbid expanded shadowing to avoid time travel.
|
||||
if restricted_shadowing &&
|
||||
binding.expansion != Mark::root() &&
|
||||
binding.expansion != ExpnId::root() &&
|
||||
binding.res() != shadowed_glob.res() {
|
||||
self.ambiguity_errors.push(AmbiguityError {
|
||||
kind: AmbiguityKind::GlobVsExpanded,
|
||||
|
|
@ -525,7 +525,7 @@ impl<'a> Resolver<'a> {
|
|||
(binding, old_binding)
|
||||
};
|
||||
if glob_binding.res() != nonglob_binding.res() &&
|
||||
ns == MacroNS && nonglob_binding.expansion != Mark::root() {
|
||||
ns == MacroNS && nonglob_binding.expansion != ExpnId::root() {
|
||||
resolution.binding = Some(this.ambiguity(AmbiguityKind::GlobVsExpanded,
|
||||
nonglob_binding, glob_binding));
|
||||
} else {
|
||||
|
|
@ -1248,7 +1248,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
|
|||
target: Ident,
|
||||
) {
|
||||
// Skip if the import was produced by a macro.
|
||||
if directive.parent_scope.expansion != Mark::root() {
|
||||
if directive.parent_scope.expansion != ExpnId::root() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue