]> git.lizzy.rs Git - rust.git/commitdiff
libsyntax: Remove `Mark` into `ExpnId`
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Mon, 15 Jul 2019 22:04:05 +0000 (01:04 +0300)
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Fri, 19 Jul 2019 09:01:48 +0000 (12:01 +0300)
23 files changed:
src/librustc/hir/lowering.rs
src/librustc/hir/map/def_collector.rs
src/librustc/hir/map/definitions.rs
src/librustc/ich/hcx.rs
src/librustc/ty/mod.rs
src/librustc/ty/query/on_disk_cache.rs
src/librustc_allocator/expand.rs
src/librustc_codegen_ssa/back/write.rs
src/librustc_metadata/decoder.rs
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/lib.rs
src/librustc_resolve/macros.rs
src/librustc_resolve/resolve_imports.rs
src/libsyntax/ast.rs
src/libsyntax/ext/base.rs
src/libsyntax/ext/expand.rs
src/libsyntax/ext/placeholders.rs
src/libsyntax/std_inject.rs
src/libsyntax/test.rs
src/libsyntax/tokenstream.rs
src/libsyntax_ext/proc_macro_decls.rs
src/libsyntax_pos/hygiene.rs
src/libsyntax_pos/lib.rs

index 7e7bb5f61a3241ad91cf53000dec3ff92a46f718..c228bc2cf6b8c33d22bbba60258c93e0c84a5f4e 100644 (file)
@@ -60,7 +60,7 @@
 use syntax::ast;
 use syntax::ast::*;
 use syntax::errors;
-use syntax::ext::hygiene::Mark;
+use syntax::ext::hygiene::ExpnId;
 use syntax::print::pprust;
 use syntax::source_map::{respan, ExpnInfo, ExpnKind, DesugaringKind, Spanned};
 use syntax::std_inject;
@@ -437,7 +437,7 @@ fn allocate_use_tree_hir_id_counters(
                                 owner,
                                 id,
                                 DefPathData::Misc,
-                                Mark::root(),
+                                ExpnId::root(),
                                 tree.prefix.span,
                             );
                             self.lctx.allocate_hir_id_counter(id);
@@ -875,7 +875,7 @@ fn mark_span_with_reason(
         span: Span,
         allow_internal_unstable: Option<Lrc<[Symbol]>>,
     ) -> Span {
-        span.fresh_expansion(Mark::root(), ExpnInfo {
+        span.fresh_expansion(ExpnId::root(), ExpnInfo {
             def_site: span,
             allow_internal_unstable,
             ..ExpnInfo::default(ExpnKind::Desugaring(reason), span, self.sess.edition())
@@ -968,7 +968,7 @@ fn lifetime_to_generic_param(
             parent_index,
             node_id,
             DefPathData::LifetimeNs(str_name),
-            Mark::root(),
+            ExpnId::root(),
             span,
         );
 
@@ -1462,7 +1462,7 @@ fn lower_assoc_ty_constraint(&mut self,
                         parent_def_index,
                         impl_trait_node_id,
                         DefPathData::ImplTrait,
-                        Mark::root(),
+                        ExpnId::root(),
                         DUMMY_SP
                     );
 
@@ -1921,7 +1921,7 @@ fn visit_lifetime(&mut self, lifetime: &'v hir::Lifetime) {
                         self.parent,
                         def_node_id,
                         DefPathData::LifetimeNs(name.ident().as_interned_str()),
-                        Mark::root(),
+                        ExpnId::root(),
                         lifetime.span);
 
                     let (name, kind) = match name {
index 6b93bd96a2718e435707c579835d9882ac52e419..854b09c6dc914c2be06890e01096948416627929 100644 (file)
@@ -2,7 +2,7 @@
 use crate::hir::def_id::DefIndex;
 
 use syntax::ast::*;
-use syntax::ext::hygiene::Mark;
+use syntax::ext::hygiene::ExpnId;
 use syntax::visit;
 use syntax::symbol::{kw, sym};
 use syntax::parse::token::{self, Token};
 pub struct DefCollector<'a> {
     definitions: &'a mut Definitions,
     parent_def: DefIndex,
-    expansion: Mark,
+    expansion: ExpnId,
 }
 
 impl<'a> DefCollector<'a> {
-    pub fn new(definitions: &'a mut Definitions, expansion: Mark) -> Self {
+    pub fn new(definitions: &'a mut Definitions, expansion: ExpnId) -> Self {
         let parent_def = definitions.invocation_parent(expansion);
         DefCollector { definitions, parent_def, expansion }
     }
index 9188a78e489ef03107e2a8940605161747c683ec..bbaa731abc995eeb4b00d79c5a79c0fb9d3de1be 100644 (file)
@@ -15,7 +15,7 @@
 use std::fmt::Write;
 use std::hash::Hash;
 use syntax::ast;
-use syntax::ext::hygiene::Mark;
+use syntax::ext::hygiene::ExpnId;
 use syntax::symbol::{Symbol, sym, InternedString};
 use syntax_pos::{Span, DUMMY_SP};
 use crate::util::nodemap::NodeMap;
@@ -93,16 +93,16 @@ pub struct Definitions {
     node_to_def_index: NodeMap<DefIndex>,
     def_index_to_node: Vec<ast::NodeId>,
     pub(super) node_to_hir_id: IndexVec<ast::NodeId, hir::HirId>,
-    /// If `Mark` is an ID of some macro expansion,
+    /// If `ExpnId` is an ID of some macro expansion,
     /// then `DefId` is the normal module (`mod`) in which the expanded macro was defined.
-    parent_modules_of_macro_defs: FxHashMap<Mark, DefId>,
-    /// Item with a given `DefIndex` was defined during macro expansion with ID `Mark`.
-    expansions_that_defined: FxHashMap<DefIndex, Mark>,
+    parent_modules_of_macro_defs: FxHashMap<ExpnId, DefId>,
+    /// Item with a given `DefIndex` was defined during macro expansion with ID `ExpnId`.
+    expansions_that_defined: FxHashMap<DefIndex, ExpnId>,
     next_disambiguator: FxHashMap<(DefIndex, DefPathData), u32>,
     def_index_to_span: FxHashMap<DefIndex, Span>,
-    /// When collecting definitions from an AST fragment produced by a macro invocation `Mark`
+    /// When collecting definitions from an AST fragment produced by a macro invocation `ExpnId`
     /// we know what parent node that fragment should be attached to thanks to this table.
-    invocation_parents: FxHashMap<Mark, DefIndex>,
+    invocation_parents: FxHashMap<ExpnId, DefIndex>,
 }
 
 /// A unique identifier that we can use to lookup a definition
@@ -437,7 +437,7 @@ pub fn create_root_def(&mut self,
         assert!(self.def_index_to_node.is_empty());
         self.def_index_to_node.push(ast::CRATE_NODE_ID);
         self.node_to_def_index.insert(ast::CRATE_NODE_ID, root_index);
-        self.set_invocation_parent(Mark::root(), root_index);
+        self.set_invocation_parent(ExpnId::root(), root_index);
 
         // Allocate some other DefIndices that always must exist.
         GlobalMetaDataKind::allocate_def_indices(self);
@@ -450,7 +450,7 @@ pub fn create_def_with_parent(&mut self,
                                   parent: DefIndex,
                                   node_id: ast::NodeId,
                                   data: DefPathData,
-                                  expansion: Mark,
+                                  expansion: ExpnId,
                                   span: Span)
                                   -> DefIndex {
         debug!("create_def_with_parent(parent={:?}, node_id={:?}, data={:?})",
@@ -498,7 +498,7 @@ pub fn create_def_with_parent(&mut self,
             self.node_to_def_index.insert(node_id, index);
         }
 
-        if expansion != Mark::root() {
+        if expansion != ExpnId::root() {
             self.expansions_that_defined.insert(index, expansion);
         }
 
@@ -519,23 +519,23 @@ pub fn init_node_id_to_hir_id_mapping(&mut self,
         self.node_to_hir_id = mapping;
     }
 
-    pub fn expansion_that_defined(&self, index: DefIndex) -> Mark {
-        self.expansions_that_defined.get(&index).cloned().unwrap_or(Mark::root())
+    pub fn expansion_that_defined(&self, index: DefIndex) -> ExpnId {
+        self.expansions_that_defined.get(&index).cloned().unwrap_or(ExpnId::root())
     }
 
-    pub fn parent_module_of_macro_def(&self, mark: Mark) -> DefId {
+    pub fn parent_module_of_macro_def(&self, mark: ExpnId) -> DefId {
         self.parent_modules_of_macro_defs[&mark]
     }
 
-    pub fn add_parent_module_of_macro_def(&mut self, mark: Mark, module: DefId) {
+    pub fn add_parent_module_of_macro_def(&mut self, mark: ExpnId, module: DefId) {
         self.parent_modules_of_macro_defs.insert(mark, module);
     }
 
-    pub fn invocation_parent(&self, invoc_id: Mark) -> DefIndex {
+    pub fn invocation_parent(&self, invoc_id: ExpnId) -> DefIndex {
         self.invocation_parents[&invoc_id]
     }
 
-    pub fn set_invocation_parent(&mut self, invoc_id: Mark, parent: DefIndex) {
+    pub fn set_invocation_parent(&mut self, invoc_id: ExpnId, parent: DefIndex) {
         let old_parent = self.invocation_parents.insert(invoc_id, parent);
         assert!(old_parent.is_none(), "parent def-index is reset for an invocation");
     }
@@ -624,7 +624,7 @@ fn allocate_def_indices(definitions: &mut Definitions) {
                         CRATE_DEF_INDEX,
                         ast::DUMMY_NODE_ID,
                         DefPathData::GlobalMetaData(instance.name().as_interned_str()),
-                        Mark::root(),
+                        ExpnId::root(),
                         DUMMY_SP
                     );
 
index 4ef4d70ee1dcdd7625459beee80a134bccd02f8a..d85ef1f15677f9d43788e8d1965b7fe11a15c5f2 100644 (file)
@@ -359,7 +359,7 @@ fn hash_stable<W: StableHasherResult>(&self,
             // times, we cache a stable hash of it and hash that instead of
             // recursing every time.
             thread_local! {
-                static CACHE: RefCell<FxHashMap<hygiene::Mark, u64>> = Default::default();
+                static CACHE: RefCell<FxHashMap<hygiene::ExpnId, u64>> = Default::default();
             }
 
             let sub_hash: u64 = CACHE.with(|cache| {
index 6701c20b0a3660e43e659bb125938244e0c1de9a..538afa6054ff9611ad635915e35bc1f3d8fb3598 100644 (file)
@@ -44,7 +44,7 @@
 use std::ops::Range;
 use syntax::ast::{self, Name, Ident, NodeId};
 use syntax::attr;
-use syntax::ext::hygiene::Mark;
+use syntax::ext::hygiene::ExpnId;
 use syntax::symbol::{kw, sym, Symbol, LocalInternedString, InternedString};
 use syntax_pos::Span;
 
@@ -3071,10 +3071,10 @@ pub fn hygienic_eq(self, use_name: Ident, def_name: Ident, def_parent_def_id: De
                                          self.expansion_that_defined(def_parent_def_id))
     }
 
-    fn expansion_that_defined(self, scope: DefId) -> Mark {
+    fn expansion_that_defined(self, scope: DefId) -> ExpnId {
         match scope.krate {
             LOCAL_CRATE => self.hir().definitions().expansion_that_defined(scope.index),
-            _ => Mark::root(),
+            _ => ExpnId::root(),
         }
     }
 
index a508d9846bce3c059c74863c15b827f2c5904a1b..333964514c1819dc4745b56e107cdb7dd58561b7 100644 (file)
@@ -23,7 +23,7 @@
 use syntax::ast::NodeId;
 use syntax::source_map::{SourceMap, StableSourceFileId};
 use syntax_pos::{BytePos, Span, DUMMY_SP, SourceFile};
-use syntax_pos::hygiene::{Mark, SyntaxContext, ExpnInfo};
+use syntax_pos::hygiene::{ExpnId, SyntaxContext, ExpnInfo};
 
 const TAG_FILE_FOOTER: u128 = 0xC0FFEE_C0FFEE_C0FFEE_C0FFEE_C0FFEE;
 
@@ -594,7 +594,7 @@ fn specialized_decode(&mut self) -> Result<Span, Self::Error> {
         // as long as incremental compilation does not kick in before that.
         let location = || Span::new(lo, hi, SyntaxContext::empty());
         let recover_from_expn_info = |this: &Self, expn_info, pos| {
-            let span = location().fresh_expansion(Mark::root(), expn_info);
+            let span = location().fresh_expansion(ExpnId::root(), expn_info);
             this.synthetic_expansion_infos.borrow_mut().insert(pos, span.ctxt());
             span
         };
@@ -725,7 +725,7 @@ struct CacheEncoder<'a, 'tcx, E: ty_codec::TyEncoder> {
     encoder: &'a mut E,
     type_shorthands: FxHashMap<Ty<'tcx>, usize>,
     predicate_shorthands: FxHashMap<ty::Predicate<'tcx>, usize>,
-    expn_info_shorthands: FxHashMap<Mark, AbsoluteBytePos>,
+    expn_info_shorthands: FxHashMap<ExpnId, AbsoluteBytePos>,
     interpret_allocs: FxHashMap<interpret::AllocId, usize>,
     interpret_allocs_inverse: Vec<interpret::AllocId>,
     source_map: CachingSourceMapView<'tcx>,
index 9803ee99f1a47714f4412fb70ded9142bd574b12..87373364c4d9e3d26753f667c03ac52d86774f84 100644 (file)
@@ -14,7 +14,7 @@
         base::{ExtCtxt, MacroKind, Resolver},
         build::AstBuilder,
         expand::ExpansionConfig,
-        hygiene::Mark,
+        hygiene::ExpnId,
     },
     mut_visit::{self, MutVisitor},
     parse::ParseSess,
@@ -85,7 +85,7 @@ impl MutVisitor for ExpandAllocatorDirectives<'_> {
         self.found = true;
 
         // Create a new expansion for the generated allocator code.
-        let span = item.span.fresh_expansion(Mark::root(), ExpnInfo::allow_unstable(
+        let span = item.span.fresh_expansion(ExpnId::root(), ExpnInfo::allow_unstable(
             ExpnKind::Macro(MacroKind::Attr, sym::global_allocator), item.span, self.sess.edition,
             [sym::rustc_attrs][..].into(),
         ));
index 7bb2cc7c08977c0a03dd05a1f7e6225cf591437c..c9e4663fdbddfa2eb688e3b4c330a33d47db732d 100644 (file)
@@ -26,7 +26,7 @@
 use rustc_errors::emitter::{Emitter};
 use rustc_target::spec::MergeFunctions;
 use syntax::attr;
-use syntax::ext::hygiene::Mark;
+use syntax::ext::hygiene::ExpnId;
 use syntax_pos::MultiSpan;
 use syntax_pos::symbol::{Symbol, sym};
 use jobserver::{Client, Acquired};
@@ -1775,7 +1775,7 @@ pub fn check(&self, sess: &Session, blocking: bool) {
                     }
                 }
                 Ok(SharedEmitterMessage::InlineAsmError(cookie, msg)) => {
-                    match Mark::from_u32(cookie).expn_info() {
+                    match ExpnId::from_u32(cookie).expn_info() {
                         Some(ei) => sess.span_err(ei.call_site, &msg),
                         None     => sess.err(&msg),
                     }
index 6a5f62aec1537f35fd5a7d43c0630ae28b78d241..8e76dbb882e3bdce6cc5a3fabe1fc7ef7bf9851a 100644 (file)
@@ -31,7 +31,7 @@
 use syntax::source_map;
 use syntax::symbol::{Symbol, sym};
 use syntax::ext::base::{MacroKind, SyntaxExtension};
-use syntax::ext::hygiene::Mark;
+use syntax::ext::hygiene::ExpnId;
 use syntax_pos::{self, Span, BytePos, Pos, DUMMY_SP, NO_EXPANSION};
 use log::debug;
 
@@ -458,7 +458,7 @@ fn def_kind(&self) -> Option<DefKind> {
             crate_root,
             ast::DUMMY_NODE_ID,
             DefPathData::MacroNs(name.as_interned_str()),
-            Mark::root(),
+            ExpnId::root(),
             DUMMY_SP);
         debug!("definition for {:?} is {:?}", name, def_index);
         assert_eq!(def_index, DefIndex::from_proc_macro_index(index));
index 4554980071272d481ed81786517959aa5f80319b..9ac6399689829a15395c7580a0756698d7ff567f 100644 (file)
@@ -30,7 +30,7 @@
 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 @@
 
 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 @@ fn to_name_binding(self, arenas: &'a ResolverArenas<'a>) -> &'a NameBinding<'a>
     }
 }
 
-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 @@ fn to_name_binding(self, arenas: &'a ResolverArenas<'a>) -> &'a NameBinding<'a>
 
 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 @@ fn build_reduced_graph_for_item(&mut self, item: &Item, parent_scope: ParentScop
                 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 @@ fn build_reduced_graph_for_variant(&mut self,
                                        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 @@ fn build_reduced_graph_for_variant(&mut self,
     }
 
     /// 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 @@ fn build_reduced_graph_for_foreign_item(&mut self, item: &ForeignItem, expansion
         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 @@ fn build_reduced_graph_for_external_crate_res(
         // 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 @@ pub fn get_module(&mut self, def_id: DefId) -> Module<'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 @@ fn process_legacy_macro_imports(&mut self, item: &Item, module: Module<'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 @@ fn contains_macro_use(&mut self, attrs: &[ast::Attribute]) -> bool {
 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> {
index ba8cfdcf53548afad8d96864e003bdeea3c7ef7b..d088197b45d17eba7bbfbc43a13c7bb22bd0dcfb 100644 (file)
@@ -39,7 +39,7 @@
 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 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 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 @@ fn article(&self) -> &'static str {
     // 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 @@ pub fn new(session: &'a Session,
         );
         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 @@ pub fn new(session: &'a Session,
         }
 
         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 @@ pub fn new(session: &'a Session,
             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 @@ fn new_module(
         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 @@ fn visit_scopes<T>(
                 }
                 Scope::CrateRoot => match ns {
                     TypeNS => {
-                        ident.span.adjust(Mark::root());
+                        ident.span.adjust(ExpnId::root());
                         Scope::ExternPrelude
                     }
                     ValueNS | MacroNS => break,
@@ -2253,7 +2253,7 @@ fn visit_scopes<T>(
                     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 @@ fn resolve_ident_in_lexical_scope(&mut self,
         }
 
         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 @@ fn resolve_ident_in_lexical_scope(&mut self,
             }
             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 @@ fn resolve_ident_in_module_ext(
                 }
             }
             ModuleOrUniformRoot::ExternPrelude => {
-                ident.span.modernize_and_adjust(Mark::root());
+                ident.span.modernize_and_adjust(ExpnId::root());
             }
             ModuleOrUniformRoot::CrateRootAndExternPrelude |
             ModuleOrUniformRoot::CurrentScope => {
@@ -2552,7 +2552,7 @@ fn resolve_crate_root(&mut self, ident: Ident) -> Module<'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 @@ fn extern_prelude_get(&mut self, ident: Ident, speculative: bool)
                 };
                 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))
             }
         })
index 34e85e1cf1011ce7d90cff88e344ad994c8cdb4c..6fa97df5e17da121cd70f99a76979b90085cb4c4 100644 (file)
@@ -16,7 +16,7 @@
 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 @@ fn next_node_id(&mut self) -> ast::NodeId {
         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 @@ fn resolve_dollar_crates(&mut self) {
         });
     }
 
-    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 @@ fn add_builtin(&mut self, ident: ast::Ident, ext: Lrc<SyntaxExtension>) {
             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 @@ fn resolve_imports(&mut self) {
         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 @@ fn check_unused_macros(&self) {
 
 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 @@ struct Flags: u8 {
                                                       &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 @@ struct Flags: u8 {
                 }
                 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 @@ struct Flags: u8 {
                 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 @@ struct Flags: u8 {
                     )),
                 }
                 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 @@ struct Flags: u8 {
                                                  .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 @@ struct Flags: u8 {
             // 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 @@ fn prohibit_imported_non_macro_attrs(&self, binding: Option<&'a NameBinding<'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) => {
index 14622fd9f91fa545d5f010374a98562024f2baba..1960c06e86e4c7487f75543631da94ad4584b741 100644 (file)
@@ -28,7 +28,7 @@
 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 @@ fn resolution(&self, module: Module<'a>, ident: Ident, ns: Namespace)
                         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 @@ fn resolution(&self, module: Module<'a>, ident: Ident, ns: Namespace)
             .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 @@ fn resolution(&self, module: Module<'a>, ident: Ident, ns: Namespace)
                     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 @@ pub fn try_define(&mut self,
                             (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 @@ fn check_for_redundant_imports(
         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;
         }
 
index 6cfc1b77e03feeb3505f475f63d1b11449ddc819..eb67fb94b7d614739253cfe6558ec6285c37b57b 100644 (file)
@@ -5,7 +5,7 @@
 pub use crate::symbol::{Ident, Symbol as Name};
 pub use crate::util::parser::ExprPrecedence;
 
-use crate::ext::hygiene::{Mark, SyntaxContext};
+use crate::ext::hygiene::{ExpnId, SyntaxContext};
 use crate::parse::token::{self, DelimToken};
 use crate::print::pprust;
 use crate::ptr::P;
@@ -251,12 +251,12 @@ pub struct NodeId {
 pub use node_id_inner::NodeId;
 
 impl NodeId {
-    pub fn placeholder_from_mark(mark: Mark) -> Self {
+    pub fn placeholder_from_mark(mark: ExpnId) -> Self {
         NodeId::from_u32(mark.as_u32())
     }
 
-    pub fn placeholder_to_mark(self) -> Mark {
-        Mark::from_u32(self.as_u32())
+    pub fn placeholder_to_mark(self) -> ExpnId {
+        ExpnId::from_u32(self.as_u32())
     }
 }
 
index 37d5885db60c3c3d81b649b72df15261c6902cc1..00b614d1584eef7273ac482dd8780d9e9b871501 100644 (file)
@@ -3,7 +3,7 @@
 use crate::source_map::{SourceMap, Spanned, respan};
 use crate::edition::Edition;
 use crate::ext::expand::{self, AstFragment, Invocation};
-use crate::ext::hygiene::{Mark, SyntaxContext, Transparency};
+use crate::ext::hygiene::{ExpnId, SyntaxContext, Transparency};
 use crate::mut_visit::{self, MutVisitor};
 use crate::parse::{self, parser, DirectoryOwnership};
 use crate::parse::token;
@@ -682,16 +682,16 @@ pub fn expn_info(&self, call_site: Span, descr: Symbol) -> ExpnInfo {
 pub trait Resolver {
     fn next_node_id(&mut self) -> ast::NodeId;
 
-    fn get_module_scope(&mut self, id: ast::NodeId) -> Mark;
+    fn get_module_scope(&mut self, id: ast::NodeId) -> ExpnId;
 
     fn resolve_dollar_crates(&mut self);
-    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]);
     fn add_builtin(&mut self, ident: ast::Ident, ext: Lrc<SyntaxExtension>);
 
     fn resolve_imports(&mut self);
 
-    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>;
 
     fn check_unused_macros(&self);
@@ -705,7 +705,7 @@ pub struct ModuleData {
 
 #[derive(Clone)]
 pub struct ExpansionData {
-    pub mark: Mark,
+    pub mark: ExpnId,
     pub depth: usize,
     pub module: Rc<ModuleData>,
     pub directory_ownership: DirectoryOwnership,
@@ -735,7 +735,7 @@ pub fn new(parse_sess: &'a parse::ParseSess,
             root_path: PathBuf::new(),
             resolver,
             current_expansion: ExpansionData {
-                mark: Mark::root(),
+                mark: ExpnId::root(),
                 depth: 0,
                 module: Rc::new(ModuleData { mod_path: Vec::new(), directory: PathBuf::new() }),
                 directory_ownership: DirectoryOwnership::Owned { relative: None },
index 7f4b9904cab82622567c790ddb754e316537e5db..8eb26ae8d33080abf529e7c9d85feb470f247318 100644 (file)
@@ -5,7 +5,7 @@
 use crate::config::StripUnconfigured;
 use crate::ext::base::*;
 use crate::ext::derive::{add_derived_markers, collect_derives};
-use crate::ext::hygiene::{Mark, SyntaxContext, ExpnInfo, ExpnKind};
+use crate::ext::hygiene::{ExpnId, SyntaxContext, ExpnInfo, ExpnKind};
 use crate::ext::placeholders::{placeholder, PlaceholderExpander};
 use crate::feature_gate::{self, Features, GateIssue, is_builtin_attr, emit_feature_err};
 use crate::mut_visit::*;
@@ -304,7 +304,7 @@ fn expand_fragment(&mut self, input_fragment: AstFragment) -> AstFragment {
         // Unresolved macros produce dummy outputs as a recovery measure.
         invocations.reverse();
         let mut expanded_fragments = Vec::new();
-        let mut derives: FxHashMap<Mark, Vec<_>> = FxHashMap::default();
+        let mut derives: FxHashMap<ExpnId, Vec<_>> = FxHashMap::default();
         let mut undetermined_invocations = Vec::new();
         let (mut progress, mut force) = (false, !self.monotonic);
         loop {
@@ -367,7 +367,7 @@ fn expand_fragment(&mut self, input_fragment: AstFragment) -> AstFragment {
                 derives.reserve(traits.len());
                 invocations.reserve(traits.len());
                 for path in traits {
-                    let mark = Mark::fresh(self.cx.current_expansion.mark, None);
+                    let mark = ExpnId::fresh(self.cx.current_expansion.mark, None);
                     derives.push(mark);
                     invocations.push(Invocation {
                         kind: InvocationKind::Derive {
@@ -423,7 +423,7 @@ fn resolve_imports(&mut self) {
     /// them with "placeholders" - dummy macro invocations with specially crafted `NodeId`s.
     /// Then call into resolver that builds a skeleton ("reduced graph") of the fragment and
     /// prepares data for resolving paths of macro invocations.
-    fn collect_invocations(&mut self, mut fragment: AstFragment, derives: &[Mark])
+    fn collect_invocations(&mut self, mut fragment: AstFragment, derives: &[ExpnId])
                            -> (AstFragment, Vec<Invocation>) {
         // Resolve `$crate`s in the fragment for pretty-printing.
         self.cx.resolver.resolve_dollar_crates();
@@ -822,7 +822,7 @@ fn collect(&mut self, fragment_kind: AstFragmentKind, kind: InvocationKind) -> A
             )),
             _ => None,
         };
-        let mark = Mark::fresh(self.cx.current_expansion.mark, expn_info);
+        let mark = ExpnId::fresh(self.cx.current_expansion.mark, expn_info);
         self.invocations.push(Invocation {
             kind,
             fragment_kind,
@@ -1402,7 +1402,7 @@ fn custom_inner_attributes(&self) -> bool {
 
 // A Marker adds the given mark to the syntax context.
 #[derive(Debug)]
-pub struct Marker(pub Mark);
+pub struct Marker(pub ExpnId);
 
 impl MutVisitor for Marker {
     fn visit_span(&mut self, span: &mut Span) {
index b2b8bfb09b45e9206603929424642976a6390644..872292bb600f8a58085d57869c2957fe11d2ef0b 100644 (file)
@@ -2,7 +2,7 @@
 use crate::source_map::{DUMMY_SP, dummy_spanned};
 use crate::ext::base::ExtCtxt;
 use crate::ext::expand::{AstFragment, AstFragmentKind};
-use crate::ext::hygiene::Mark;
+use crate::ext::hygiene::ExpnId;
 use crate::tokenstream::TokenStream;
 use crate::mut_visit::*;
 use crate::ptr::P;
@@ -84,7 +84,7 @@ pub fn new(cx: &'a mut ExtCtxt<'b>, monotonic: bool) -> Self {
         }
     }
 
-    pub fn add(&mut self, id: ast::NodeId, mut fragment: AstFragment, derives: Vec<Mark>) {
+    pub fn add(&mut self, id: ast::NodeId, mut fragment: AstFragment, derives: Vec<ExpnId>) {
         fragment.mut_visit_with(self);
         if let AstFragment::Items(mut items) = fragment {
             for derive in derives {
index d86b76f71eca7d155ae79f701555c6a091a5fda1..3fba81c0b691149f6d4a2726804236069e97b041 100644 (file)
@@ -1,7 +1,7 @@
 use crate::ast;
 use crate::attr;
 use crate::edition::Edition;
-use crate::ext::hygiene::{Mark, MacroKind};
+use crate::ext::hygiene::{ExpnId, MacroKind};
 use crate::symbol::{Ident, Symbol, kw, sym};
 use crate::source_map::{ExpnInfo, ExpnKind, dummy_spanned, respan};
 use crate::ptr::P;
@@ -75,7 +75,7 @@ pub fn maybe_inject_crates_ref(
 
     INJECTED_CRATE_NAME.with(|opt_name| opt_name.set(Some(name)));
 
-    let span = DUMMY_SP.fresh_expansion(Mark::root(), ExpnInfo::allow_unstable(
+    let span = DUMMY_SP.fresh_expansion(ExpnId::root(), ExpnInfo::allow_unstable(
         ExpnKind::Macro(MacroKind::Attr, sym::std_inject), DUMMY_SP, edition,
         [sym::prelude_import][..].into(),
     ));
index 799d64a9962371070fc5ba68223ce07ed1714388..72d62dbd46b2b1a36fc33e28f59bebd22e74a5dc 100644 (file)
@@ -21,7 +21,7 @@
 use crate::ext::base::{ExtCtxt, Resolver};
 use crate::ext::build::AstBuilder;
 use crate::ext::expand::ExpansionConfig;
-use crate::ext::hygiene::{self, Mark, SyntaxContext, MacroKind};
+use crate::ext::hygiene::{self, ExpnId, SyntaxContext, MacroKind};
 use crate::mut_visit::{*, ExpectOne};
 use crate::feature_gate::Features;
 use crate::util::map_in_place::MapInPlace;
@@ -303,7 +303,7 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> P<ast::Item> {
     //            #![main]
     //            test::test_main_static(&[..tests]);
     //        }
-    let sp = DUMMY_SP.fresh_expansion(Mark::root(), ExpnInfo::allow_unstable(
+    let sp = DUMMY_SP.fresh_expansion(ExpnId::root(), ExpnInfo::allow_unstable(
         ExpnKind::Macro(MacroKind::Attr, sym::test_case), DUMMY_SP, cx.ext_cx.parse_sess.edition,
         [sym::main, sym::test, sym::rustc_attrs][..].into(),
     ));
index b32049b1da8c365992d1b284701b4553b654b331..1f05be3a51962e3d89faef66472d9b6d51636be6 100644 (file)
@@ -19,7 +19,7 @@
 use crate::parse::token::{self, DelimToken, Token, TokenKind};
 use crate::print::pprust;
 
-use syntax_pos::{BytePos, Mark, Span, DUMMY_SP};
+use syntax_pos::{BytePos, ExpnId, Span, DUMMY_SP};
 #[cfg(target_arch = "x86_64")]
 use rustc_data_structures::static_assert_size;
 use rustc_data_structures::sync::Lrc;
@@ -545,7 +545,7 @@ pub fn entire(self) -> Span {
         self.open.with_hi(self.close.hi())
     }
 
-    pub fn apply_mark(self, mark: Mark) -> Self {
+    pub fn apply_mark(self, mark: ExpnId) -> Self {
         DelimSpan {
             open: self.open.apply_mark(mark),
             close: self.close.apply_mark(mark),
index 2f78644dff2aa89e2673fcce79f0a3d4e5c069e9..08c40dde56c858283a5250054474ff9228927f00 100644 (file)
@@ -8,7 +8,7 @@
 use syntax::ext::base::{ExtCtxt, MacroKind};
 use syntax::ext::build::AstBuilder;
 use syntax::ext::expand::ExpansionConfig;
-use syntax::ext::hygiene::Mark;
+use syntax::ext::hygiene::ExpnId;
 use syntax::mut_visit::MutVisitor;
 use syntax::parse::ParseSess;
 use syntax::ptr::P;
@@ -346,7 +346,7 @@ fn mk_decls(
     custom_attrs: &[ProcMacroDef],
     custom_macros: &[ProcMacroDef],
 ) -> P<ast::Item> {
-    let span = DUMMY_SP.fresh_expansion(Mark::root(), ExpnInfo::allow_unstable(
+    let span = DUMMY_SP.fresh_expansion(ExpnId::root(), ExpnInfo::allow_unstable(
         ExpnKind::Macro(MacroKind::Attr, sym::proc_macro), DUMMY_SP, cx.parse_sess.edition,
         [sym::rustc_attrs, sym::proc_macro_internals][..].into(),
     ));
index 5df14439230906e338d5e33ebb5481dd92896175..731a2d1c12144b156d39511745117b240b0add70 100644 (file)
 // ensuring that multiple HygieneData accesses are combined into a single
 // `HygieneData::with`.
 //
-// This explains why `HygieneData`, `SyntaxContext` and `Mark` have interfaces
+// This explains why `HygieneData`, `SyntaxContext` and `ExpnId` have interfaces
 // with a certain amount of redundancy in them. For example,
 // `SyntaxContext::outer_expn_info` combines `SyntaxContext::outer` and
-// `Mark::expn_info` so that two `HygieneData` accesses can be performed within
+// `ExpnId::expn_info` so that two `HygieneData` accesses can be performed within
 // a single `HygieneData::with` call.
 //
 // It also explains why many functions appear in `HygieneData` and again in
-// `SyntaxContext` or `Mark`. For example, `HygieneData::outer` and
+// `SyntaxContext` or `ExpnId`. For example, `HygieneData::outer` and
 // `SyntaxContext::outer` do the same thing, but the former is for use within a
 // `HygieneData::with` call while the latter is for use outside such a call.
 // When modifying this file it is important to understand this distinction,
@@ -41,7 +41,7 @@
 
 #[derive(Debug)]
 struct SyntaxContextData {
-    outer_mark: Mark,
+    outer_mark: ExpnId,
     transparency: Transparency,
     prev_ctxt: SyntaxContext,
     /// This context, but with all transparent and semi-transparent marks filtered away.
@@ -54,11 +54,11 @@ struct SyntaxContextData {
 
 /// A mark is a unique ID associated with a macro expansion.
 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
-pub struct Mark(u32);
+pub struct ExpnId(u32);
 
 #[derive(Debug)]
 struct MarkData {
-    parent: Mark,
+    parent: ExpnId,
     /// Each mark should have an associated expansion info, but sometimes there's a delay between
     /// creation of a mark and obtaining its info (e.g. macros are collected first and then
     /// resolved later), so we use an `Option` here.
@@ -84,15 +84,15 @@ pub enum Transparency {
     Opaque,
 }
 
-impl Mark {
-    pub fn fresh(parent: Mark, expn_info: Option<ExpnInfo>) -> Self {
+impl ExpnId {
+    pub fn fresh(parent: ExpnId, expn_info: Option<ExpnInfo>) -> Self {
         HygieneData::with(|data| data.fresh_mark(parent, expn_info))
     }
 
     /// The mark of the theoretical expansion that generates freshly parsed, unexpanded AST.
     #[inline]
     pub fn root() -> Self {
-        Mark(0)
+        ExpnId(0)
     }
 
     #[inline]
@@ -101,12 +101,12 @@ pub fn as_u32(self) -> u32 {
     }
 
     #[inline]
-    pub fn from_u32(raw: u32) -> Mark {
-        Mark(raw)
+    pub fn from_u32(raw: u32) -> ExpnId {
+        ExpnId(raw)
     }
 
     #[inline]
-    pub fn parent(self) -> Mark {
+    pub fn parent(self) -> ExpnId {
         HygieneData::with(|data| data.marks[self.0 as usize].parent)
     }
 
@@ -124,7 +124,7 @@ pub fn set_expn_info(self, info: ExpnInfo) {
         })
     }
 
-    pub fn is_descendant_of(self, ancestor: Mark) -> bool {
+    pub fn is_descendant_of(self, ancestor: ExpnId) -> bool {
         HygieneData::with(|data| data.is_descendant_of(self, ancestor))
     }
 
@@ -154,18 +154,18 @@ pub fn looks_like_proc_macro_derive(self) -> bool {
 crate struct HygieneData {
     marks: Vec<MarkData>,
     syntax_contexts: Vec<SyntaxContextData>,
-    markings: FxHashMap<(SyntaxContext, Mark, Transparency), SyntaxContext>,
+    markings: FxHashMap<(SyntaxContext, ExpnId, Transparency), SyntaxContext>,
 }
 
 impl HygieneData {
     crate fn new(edition: Edition) -> Self {
         HygieneData {
             marks: vec![MarkData {
-                parent: Mark::root(),
+                parent: ExpnId::root(),
                 expn_info: Some(ExpnInfo::default(ExpnKind::Root, DUMMY_SP, edition)),
             }],
             syntax_contexts: vec![SyntaxContextData {
-                outer_mark: Mark::root(),
+                outer_mark: ExpnId::root(),
                 transparency: Transparency::Opaque,
                 prev_ctxt: SyntaxContext(0),
                 opaque: SyntaxContext(0),
@@ -180,13 +180,13 @@ fn with<T, F: FnOnce(&mut HygieneData) -> T>(f: F) -> T {
         GLOBALS.with(|globals| f(&mut *globals.hygiene_data.borrow_mut()))
     }
 
-    fn fresh_mark(&mut self, parent: Mark, expn_info: Option<ExpnInfo>) -> Mark {
+    fn fresh_mark(&mut self, parent: ExpnId, expn_info: Option<ExpnInfo>) -> ExpnId {
         self.marks.push(MarkData { parent, expn_info });
-        Mark(self.marks.len() as u32 - 1)
+        ExpnId(self.marks.len() as u32 - 1)
     }
 
-    fn expn_info(&self, mark: Mark) -> Option<&ExpnInfo> {
-        if mark != Mark::root() {
+    fn expn_info(&self, mark: ExpnId) -> Option<&ExpnInfo> {
+        if mark != ExpnId::root() {
             Some(self.marks[mark.0 as usize].expn_info.as_ref()
                      .expect("no expansion info for a mark"))
         } else {
@@ -197,9 +197,9 @@ fn expn_info(&self, mark: Mark) -> Option<&ExpnInfo> {
         }
     }
 
-    fn is_descendant_of(&self, mut mark: Mark, ancestor: Mark) -> bool {
+    fn is_descendant_of(&self, mut mark: ExpnId, ancestor: ExpnId) -> bool {
         while mark != ancestor {
-            if mark == Mark::root() {
+            if mark == ExpnId::root() {
                 return false;
             }
             mark = self.marks[mark.0 as usize].parent;
@@ -207,7 +207,7 @@ fn is_descendant_of(&self, mut mark: Mark, ancestor: Mark) -> bool {
         true
     }
 
-    fn default_transparency(&self, mark: Mark) -> Transparency {
+    fn default_transparency(&self, mark: ExpnId) -> Transparency {
         self.expn_info(mark).map_or(
             Transparency::SemiTransparent, |einfo| einfo.default_transparency
         )
@@ -221,7 +221,7 @@ fn modern_and_legacy(&self, ctxt: SyntaxContext) -> SyntaxContext {
         self.syntax_contexts[ctxt.0 as usize].opaque_and_semitransparent
     }
 
-    fn outer(&self, ctxt: SyntaxContext) -> Mark {
+    fn outer(&self, ctxt: SyntaxContext) -> ExpnId {
         self.syntax_contexts[ctxt.0 as usize].outer_mark
     }
 
@@ -233,13 +233,13 @@ fn prev_ctxt(&self, ctxt: SyntaxContext) -> SyntaxContext {
         self.syntax_contexts[ctxt.0 as usize].prev_ctxt
     }
 
-    fn remove_mark(&self, ctxt: &mut SyntaxContext) -> Mark {
+    fn remove_mark(&self, ctxt: &mut SyntaxContext) -> ExpnId {
         let outer_mark = self.syntax_contexts[ctxt.0 as usize].outer_mark;
         *ctxt = self.prev_ctxt(*ctxt);
         outer_mark
     }
 
-    fn marks(&self, mut ctxt: SyntaxContext) -> Vec<(Mark, Transparency)> {
+    fn marks(&self, mut ctxt: SyntaxContext) -> Vec<(ExpnId, Transparency)> {
         let mut marks = Vec::new();
         while ctxt != SyntaxContext::empty() {
             let outer_mark = self.outer(ctxt);
@@ -263,7 +263,7 @@ fn walk_chain(&self, mut span: Span, to: SyntaxContext) -> Span {
         span
     }
 
-    fn adjust(&self, ctxt: &mut SyntaxContext, expansion: Mark) -> Option<Mark> {
+    fn adjust(&self, ctxt: &mut SyntaxContext, expansion: ExpnId) -> Option<ExpnId> {
         let mut scope = None;
         while !self.is_descendant_of(expansion, self.outer(*ctxt)) {
             scope = Some(self.remove_mark(ctxt));
@@ -271,14 +271,14 @@ fn adjust(&self, ctxt: &mut SyntaxContext, expansion: Mark) -> Option<Mark> {
         scope
     }
 
-    fn apply_mark(&mut self, ctxt: SyntaxContext, mark: Mark) -> SyntaxContext {
-        assert_ne!(mark, Mark::root());
+    fn apply_mark(&mut self, ctxt: SyntaxContext, mark: ExpnId) -> SyntaxContext {
+        assert_ne!(mark, ExpnId::root());
         self.apply_mark_with_transparency(ctxt, mark, self.default_transparency(mark))
     }
 
-    fn apply_mark_with_transparency(&mut self, ctxt: SyntaxContext, mark: Mark,
+    fn apply_mark_with_transparency(&mut self, ctxt: SyntaxContext, mark: ExpnId,
                                     transparency: Transparency) -> SyntaxContext {
-        assert_ne!(mark, Mark::root());
+        assert_ne!(mark, ExpnId::root());
         if transparency == Transparency::Opaque {
             return self.apply_mark_internal(ctxt, mark, transparency);
         }
@@ -310,7 +310,7 @@ fn apply_mark_with_transparency(&mut self, ctxt: SyntaxContext, mark: Mark,
         self.apply_mark_internal(call_site_ctxt, mark, transparency)
     }
 
-    fn apply_mark_internal(&mut self, ctxt: SyntaxContext, mark: Mark, transparency: Transparency)
+    fn apply_mark_internal(&mut self, ctxt: SyntaxContext, mark: ExpnId, transparency: Transparency)
                            -> SyntaxContext {
         let syntax_contexts = &mut self.syntax_contexts;
         let mut opaque = syntax_contexts[ctxt.0 as usize].opaque;
@@ -410,12 +410,12 @@ pub const fn empty() -> Self {
     }
 
     /// Extend a syntax context with a given mark and default transparency for that mark.
-    pub fn apply_mark(self, mark: Mark) -> SyntaxContext {
+    pub fn apply_mark(self, mark: ExpnId) -> SyntaxContext {
         HygieneData::with(|data| data.apply_mark(self, mark))
     }
 
     /// Extend a syntax context with a given mark and transparency
-    pub fn apply_mark_with_transparency(self, mark: Mark, transparency: Transparency)
+    pub fn apply_mark_with_transparency(self, mark: ExpnId, transparency: Transparency)
                                         -> SyntaxContext {
         HygieneData::with(|data| data.apply_mark_with_transparency(self, mark, transparency))
     }
@@ -436,11 +436,11 @@ pub fn apply_mark_with_transparency(self, mark: Mark, transparency: Transparency
     /// of g (call it g1), calling remove_mark will result in the SyntaxContext for the
     /// invocation of f that created g1.
     /// Returns the mark that was removed.
-    pub fn remove_mark(&mut self) -> Mark {
+    pub fn remove_mark(&mut self) -> ExpnId {
         HygieneData::with(|data| data.remove_mark(self))
     }
 
-    pub fn marks(self) -> Vec<(Mark, Transparency)> {
+    pub fn marks(self) -> Vec<(ExpnId, Transparency)> {
         HygieneData::with(|data| data.marks(self))
     }
 
@@ -452,13 +452,13 @@ pub fn marks(self) -> Vec<(Mark, Transparency)> {
     /// m!(f);
     /// macro m($f:ident) {
     ///     mod bar {
-    ///         pub fn f() {} // `f`'s `SyntaxContext` has a single `Mark` from `m`.
+    ///         pub fn f() {} // `f`'s `SyntaxContext` has a single `ExpnId` from `m`.
     ///         pub fn $f() {} // `$f`'s `SyntaxContext` is empty.
     ///     }
-    ///     foo::f(); // `f`'s `SyntaxContext` has a single `Mark` from `m`
+    ///     foo::f(); // `f`'s `SyntaxContext` has a single `ExpnId` from `m`
     ///     //^ Since `mod foo` is outside this expansion, `adjust` removes the mark from `f`,
     ///     //| and it resolves to `::foo::f`.
-    ///     bar::f(); // `f`'s `SyntaxContext` has a single `Mark` from `m`
+    ///     bar::f(); // `f`'s `SyntaxContext` has a single `ExpnId` from `m`
     ///     //^ Since `mod bar` not outside this expansion, `adjust` does not change `f`,
     ///     //| and it resolves to `::bar::f`.
     ///     bar::$f(); // `f`'s `SyntaxContext` is empty.
@@ -468,12 +468,12 @@ pub fn marks(self) -> Vec<(Mark, Transparency)> {
     /// ```
     /// This returns the expansion whose definition scope we use to privacy check the resolution,
     /// or `None` if we privacy check as usual (i.e., not w.r.t. a macro definition scope).
-    pub fn adjust(&mut self, expansion: Mark) -> Option<Mark> {
+    pub fn adjust(&mut self, expansion: ExpnId) -> Option<ExpnId> {
         HygieneData::with(|data| data.adjust(self, expansion))
     }
 
     /// Like `SyntaxContext::adjust`, but also modernizes `self`.
-    pub fn modernize_and_adjust(&mut self, expansion: Mark) -> Option<Mark> {
+    pub fn modernize_and_adjust(&mut self, expansion: ExpnId) -> Option<ExpnId> {
         HygieneData::with(|data| {
             *self = data.modern(*self);
             data.adjust(self, expansion)
@@ -488,7 +488,7 @@ pub fn modernize_and_adjust(&mut self, expansion: Mark) -> Option<Mark> {
     /// m!(f);
     /// macro m($i:ident) {
     ///     mod foo {
-    ///         pub fn f() {} // `f`'s `SyntaxContext` has a single `Mark` from `m`.
+    ///         pub fn f() {} // `f`'s `SyntaxContext` has a single `ExpnId` from `m`.
     ///         pub fn $i() {} // `$i`'s `SyntaxContext` is empty.
     ///     }
     ///     n(f);
@@ -505,7 +505,7 @@ pub fn modernize_and_adjust(&mut self, expansion: Mark) -> Option<Mark> {
     /// ```
     /// This returns `None` if the context cannot be glob-adjusted.
     /// Otherwise, it returns the scope to use when privacy checking (see `adjust` for details).
-    pub fn glob_adjust(&mut self, expansion: Mark, glob_span: Span) -> Option<Option<Mark>> {
+    pub fn glob_adjust(&mut self, expansion: ExpnId, glob_span: Span) -> Option<Option<ExpnId>> {
         HygieneData::with(|data| {
             let mut scope = None;
             let mut glob_ctxt = data.modern(glob_span.ctxt());
@@ -529,8 +529,8 @@ pub fn glob_adjust(&mut self, expansion: Mark, glob_span: Span) -> Option<Option
     ///     assert!(self.glob_adjust(expansion, glob_ctxt) == Some(privacy_checking_scope));
     /// }
     /// ```
-    pub fn reverse_glob_adjust(&mut self, expansion: Mark, glob_span: Span)
-                               -> Option<Option<Mark>> {
+    pub fn reverse_glob_adjust(&mut self, expansion: ExpnId, glob_span: Span)
+                               -> Option<Option<ExpnId>> {
         HygieneData::with(|data| {
             if data.adjust(self, expansion).is_some() {
                 return None;
@@ -550,7 +550,7 @@ pub fn reverse_glob_adjust(&mut self, expansion: Mark, glob_span: Span)
         })
     }
 
-    pub fn hygienic_eq(self, other: SyntaxContext, mark: Mark) -> bool {
+    pub fn hygienic_eq(self, other: SyntaxContext, mark: ExpnId) -> bool {
         HygieneData::with(|data| {
             let mut self_modern = data.modern(self);
             data.adjust(&mut self_modern, mark);
@@ -569,7 +569,7 @@ pub fn modern_and_legacy(self) -> SyntaxContext {
     }
 
     #[inline]
-    pub fn outer(self) -> Mark {
+    pub fn outer(self) -> ExpnId {
         HygieneData::with(|data| data.outer(self))
     }
 
@@ -583,7 +583,7 @@ pub fn outer_expn_info(self) -> Option<ExpnInfo> {
     /// `ctxt.outer_and_expn_info()` is equivalent to but faster than
     /// `{ let outer = ctxt.outer(); (outer, outer.expn_info()) }`.
     #[inline]
-    pub fn outer_and_expn_info(self) -> (Mark, Option<ExpnInfo>) {
+    pub fn outer_and_expn_info(self) -> (ExpnId, Option<ExpnInfo>) {
         HygieneData::with(|data| {
             let outer = data.outer(self);
             (outer, data.expn_info(outer).cloned())
@@ -607,7 +607,7 @@ impl Span {
     /// other compiler-generated code to set per-span properties like allowed unstable features.
     /// The returned span belongs to the created expansion and has the new properties,
     /// but its location is inherited from the current span.
-    pub fn fresh_expansion(self, parent: Mark, expn_info: ExpnInfo) -> Span {
+    pub fn fresh_expansion(self, parent: ExpnId, expn_info: ExpnInfo) -> Span {
         HygieneData::with(|data| {
             let mark = data.fresh_mark(parent, Some(expn_info));
             self.with_ctxt(data.apply_mark(SyntaxContext::empty(), mark))
@@ -681,7 +681,7 @@ pub fn allow_unstable(kind: ExpnKind, call_site: Span, edition: Edition,
 /// Expansion kind.
 #[derive(Clone, Debug, RustcEncodable, RustcDecodable)]
 pub enum ExpnKind {
-    /// No expansion, aka root expansion. Only `Mark::root()` has this kind.
+    /// No expansion, aka root expansion. Only `ExpnId::root()` has this kind.
     Root,
     /// Expansion produced by a macro.
     /// FIXME: Some code injected by the compiler before HIR lowering also gets this kind.
index 5ccfe5f0b8b1a8303a415ab903f94a28288090fd..a4c7c4bf28752866bbd7ccbf15fce95fbc1ace0f 100644 (file)
@@ -27,7 +27,7 @@
 pub mod edition;
 use edition::Edition;
 pub mod hygiene;
-pub use hygiene::{Mark, SyntaxContext, ExpnInfo, ExpnKind, MacroKind, DesugaringKind};
+pub use hygiene::{ExpnId, SyntaxContext, ExpnInfo, ExpnKind, MacroKind, DesugaringKind};
 
 mod span_encoding;
 pub use span_encoding::{Span, DUMMY_SP};
@@ -516,13 +516,13 @@ pub fn from_inner(self, inner: InnerSpan) -> Span {
     }
 
     #[inline]
-    pub fn apply_mark(self, mark: Mark) -> Span {
+    pub fn apply_mark(self, mark: ExpnId) -> Span {
         let span = self.data();
         span.with_ctxt(span.ctxt.apply_mark(mark))
     }
 
     #[inline]
-    pub fn remove_mark(&mut self) -> Mark {
+    pub fn remove_mark(&mut self) -> ExpnId {
         let mut span = self.data();
         let mark = span.ctxt.remove_mark();
         *self = Span::new(span.lo, span.hi, span.ctxt);
@@ -530,7 +530,7 @@ pub fn remove_mark(&mut self) -> Mark {
     }
 
     #[inline]
-    pub fn adjust(&mut self, expansion: Mark) -> Option<Mark> {
+    pub fn adjust(&mut self, expansion: ExpnId) -> Option<ExpnId> {
         let mut span = self.data();
         let mark = span.ctxt.adjust(expansion);
         *self = Span::new(span.lo, span.hi, span.ctxt);
@@ -538,7 +538,7 @@ pub fn adjust(&mut self, expansion: Mark) -> Option<Mark> {
     }
 
     #[inline]
-    pub fn modernize_and_adjust(&mut self, expansion: Mark) -> Option<Mark> {
+    pub fn modernize_and_adjust(&mut self, expansion: ExpnId) -> Option<ExpnId> {
         let mut span = self.data();
         let mark = span.ctxt.modernize_and_adjust(expansion);
         *self = Span::new(span.lo, span.hi, span.ctxt);
@@ -546,7 +546,7 @@ pub fn modernize_and_adjust(&mut self, expansion: Mark) -> Option<Mark> {
     }
 
     #[inline]
-    pub fn glob_adjust(&mut self, expansion: Mark, glob_span: Span) -> Option<Option<Mark>> {
+    pub fn glob_adjust(&mut self, expansion: ExpnId, glob_span: Span) -> Option<Option<ExpnId>> {
         let mut span = self.data();
         let mark = span.ctxt.glob_adjust(expansion, glob_span);
         *self = Span::new(span.lo, span.hi, span.ctxt);
@@ -554,8 +554,8 @@ pub fn glob_adjust(&mut self, expansion: Mark, glob_span: Span) -> Option<Option
     }
 
     #[inline]
-    pub fn reverse_glob_adjust(&mut self, expansion: Mark, glob_span: Span)
-                               -> Option<Option<Mark>> {
+    pub fn reverse_glob_adjust(&mut self, expansion: ExpnId, glob_span: Span)
+                               -> Option<Option<ExpnId>> {
         let mut span = self.data();
         let mark = span.ctxt.reverse_glob_adjust(expansion, glob_span);
         *self = Span::new(span.lo, span.hi, span.ctxt);