Skip to content

Commit 09703e3

Browse files
committed
Adjust other names after the Mark renaming
1 parent 31e10ae commit 09703e3

File tree

27 files changed

+196
-192
lines changed

27 files changed

+196
-192
lines changed

src/librustc/hir/map/def_collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl<'a> DefCollector<'a> {
7575
}
7676

7777
fn visit_macro_invoc(&mut self, id: NodeId) {
78-
self.definitions.set_invocation_parent(id.placeholder_to_mark(), self.parent_def);
78+
self.definitions.set_invocation_parent(id.placeholder_to_expn_id(), self.parent_def);
7979
}
8080
}
8181

src/librustc/hir/map/definitions.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ impl Definitions {
450450
parent: DefIndex,
451451
node_id: ast::NodeId,
452452
data: DefPathData,
453-
expansion: ExpnId,
453+
expn_id: ExpnId,
454454
span: Span)
455455
-> DefIndex {
456456
debug!("create_def_with_parent(parent={:?}, node_id={:?}, data={:?})",
@@ -498,8 +498,8 @@ impl Definitions {
498498
self.node_to_def_index.insert(node_id, index);
499499
}
500500

501-
if expansion != ExpnId::root() {
502-
self.expansions_that_defined.insert(index, expansion);
501+
if expn_id != ExpnId::root() {
502+
self.expansions_that_defined.insert(index, expn_id);
503503
}
504504

505505
// The span is added if it isn't dummy
@@ -523,12 +523,12 @@ impl Definitions {
523523
self.expansions_that_defined.get(&index).cloned().unwrap_or(ExpnId::root())
524524
}
525525

526-
pub fn parent_module_of_macro_def(&self, mark: ExpnId) -> DefId {
527-
self.parent_modules_of_macro_defs[&mark]
526+
pub fn parent_module_of_macro_def(&self, expn_id: ExpnId) -> DefId {
527+
self.parent_modules_of_macro_defs[&expn_id]
528528
}
529529

530-
pub fn add_parent_module_of_macro_def(&mut self, mark: ExpnId, module: DefId) {
531-
self.parent_modules_of_macro_defs.insert(mark, module);
530+
pub fn add_parent_module_of_macro_def(&mut self, expn_id: ExpnId, module: DefId) {
531+
self.parent_modules_of_macro_defs.insert(expn_id, module);
532532
}
533533

534534
pub fn invocation_parent(&self, invoc_id: ExpnId) -> DefIndex {

src/librustc/ty/query/on_disk_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ impl<'a, 'tcx> SpecializedDecoder<Span> for CacheDecoder<'a, 'tcx> {
588588

589589
let expn_info_tag = u8::decode(self)?;
590590

591-
// FIXME(mw): This method does not restore `MarkData::parent` or
591+
// FIXME(mw): This method does not restore `InternalExpnData::parent` or
592592
// `SyntaxContextData::prev_ctxt` or `SyntaxContextData::opaque`. These things
593593
// don't seem to be used after HIR lowering, so everything should be fine
594594
// as long as incremental compilation does not kick in before that.

src/librustc_interface/passes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ pub fn lower_to_hir(
572572

573573
// Discard hygiene data, which isn't required after lowering to HIR.
574574
if !sess.opts.debugging_opts.keep_hygiene_data {
575-
syntax::ext::hygiene::clear_markings();
575+
syntax::ext::hygiene::syntax_context_map();
576576
}
577577

578578
Ok(hir_forest)

src/librustc_resolve/build_reduced_graph.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -571,13 +571,13 @@ impl<'a> Resolver<'a> {
571571
variant: &Variant,
572572
parent: Module<'a>,
573573
vis: ty::Visibility,
574-
expansion: ExpnId) {
574+
expn_id: ExpnId) {
575575
let ident = variant.node.ident;
576576

577577
// Define a name in the type namespace.
578578
let def_id = self.definitions.local_def_id(variant.node.id);
579579
let res = Res::Def(DefKind::Variant, def_id);
580-
self.define(parent, ident, TypeNS, (res, vis, variant.span, expansion));
580+
self.define(parent, ident, TypeNS, (res, vis, variant.span, expn_id));
581581

582582
// If the variant is marked as non_exhaustive then lower the visibility to within the
583583
// crate.
@@ -596,11 +596,11 @@ impl<'a> Resolver<'a> {
596596
let ctor_def_id = self.definitions.local_def_id(ctor_node_id);
597597
let ctor_kind = CtorKind::from_ast(&variant.node.data);
598598
let ctor_res = Res::Def(DefKind::Ctor(CtorOf::Variant, ctor_kind), ctor_def_id);
599-
self.define(parent, ident, ValueNS, (ctor_res, ctor_vis, variant.span, expansion));
599+
self.define(parent, ident, ValueNS, (ctor_res, ctor_vis, variant.span, expn_id));
600600
}
601601

602602
/// Constructs the reduced graph for one foreign item.
603-
fn build_reduced_graph_for_foreign_item(&mut self, item: &ForeignItem, expansion: ExpnId) {
603+
fn build_reduced_graph_for_foreign_item(&mut self, item: &ForeignItem, expn_id: ExpnId) {
604604
let (res, ns) = match item.node {
605605
ForeignItemKind::Fn(..) => {
606606
(Res::Def(DefKind::Fn, self.definitions.local_def_id(item.id)), ValueNS)
@@ -615,16 +615,16 @@ impl<'a> Resolver<'a> {
615615
};
616616
let parent = self.current_module;
617617
let vis = self.resolve_visibility(&item.vis);
618-
self.define(parent, item.ident, ns, (res, vis, item.span, expansion));
618+
self.define(parent, item.ident, ns, (res, vis, item.span, expn_id));
619619
}
620620

621-
fn build_reduced_graph_for_block(&mut self, block: &Block, expansion: ExpnId) {
621+
fn build_reduced_graph_for_block(&mut self, block: &Block, expn_id: ExpnId) {
622622
let parent = self.current_module;
623623
if self.block_needs_anonymous_module(block) {
624624
let module = self.new_module(parent,
625625
ModuleKind::Block(block.id),
626626
parent.normal_ancestor_id,
627-
expansion,
627+
expn_id,
628628
block.span);
629629
self.block_map.insert(block.id, module);
630630
self.current_module = module; // Descend into the block.
@@ -741,8 +741,8 @@ impl<'a> Resolver<'a> {
741741
module
742742
}
743743

744-
pub fn macro_def_scope(&mut self, expansion: ExpnId) -> Module<'a> {
745-
let def_id = match self.macro_defs.get(&expansion) {
744+
pub fn macro_def_scope(&mut self, expn_id: ExpnId) -> Module<'a> {
745+
let def_id = match self.macro_defs.get(&expn_id) {
746746
Some(def_id) => *def_id,
747747
None => return self.graph_root,
748748
};
@@ -924,7 +924,7 @@ pub struct BuildReducedGraphVisitor<'a, 'b> {
924924

925925
impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
926926
fn visit_invoc(&mut self, id: ast::NodeId) -> &'b InvocationData<'b> {
927-
let invoc_id = id.placeholder_to_mark();
927+
let invoc_id = id.placeholder_to_expn_id();
928928

929929
self.resolver.current_module.unresolved_invocations.borrow_mut().insert(invoc_id);
930930

src/librustc_resolve/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2095,10 +2095,10 @@ impl<'a> Resolver<'a> {
20952095
parent: Module<'a>,
20962096
kind: ModuleKind,
20972097
normal_ancestor_id: DefId,
2098-
expansion: ExpnId,
2098+
expn_id: ExpnId,
20992099
span: Span,
21002100
) -> Module<'a> {
2101-
let module = ModuleData::new(Some(parent), kind, normal_ancestor_id, expansion, span);
2101+
let module = ModuleData::new(Some(parent), kind, normal_ancestor_id, expn_id, span);
21022102
self.arenas.alloc_module(module)
21032103
}
21042104

src/librustc_resolve/macros.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,23 +160,23 @@ impl<'a> base::Resolver for Resolver<'a> {
160160
});
161161
}
162162

163-
fn visit_ast_fragment_with_placeholders(&mut self, mark: ExpnId, fragment: &AstFragment,
163+
fn visit_ast_fragment_with_placeholders(&mut self, expn_id: ExpnId, fragment: &AstFragment,
164164
derives: &[ExpnId]) {
165-
fragment.visit_with(&mut DefCollector::new(&mut self.definitions, mark));
165+
fragment.visit_with(&mut DefCollector::new(&mut self.definitions, expn_id));
166166

167-
let invocation = self.invocations[&mark];
167+
let invocation = self.invocations[&expn_id];
168168
self.current_module = invocation.module;
169-
self.current_module.unresolved_invocations.borrow_mut().remove(&mark);
169+
self.current_module.unresolved_invocations.borrow_mut().remove(&expn_id);
170170
self.current_module.unresolved_invocations.borrow_mut().extend(derives);
171-
let parent_def = self.definitions.invocation_parent(mark);
171+
let parent_def = self.definitions.invocation_parent(expn_id);
172172
for &derive_invoc_id in derives {
173173
self.definitions.set_invocation_parent(derive_invoc_id, parent_def);
174174
}
175175
self.invocations.extend(derives.iter().map(|&derive| (derive, invocation)));
176176
let mut visitor = BuildReducedGraphVisitor {
177177
resolver: self,
178178
current_legacy_scope: invocation.parent_legacy_scope,
179-
expansion: mark,
179+
expansion: expn_id,
180180
};
181181
fragment.visit_with(&mut visitor);
182182
invocation.output_legacy_scope.set(Some(visitor.current_legacy_scope));
@@ -223,16 +223,16 @@ impl<'a> base::Resolver for Resolver<'a> {
223223
let (ext, res) = self.smart_resolve_macro_path(path, kind, &parent_scope, force)?;
224224

225225
let span = invoc.span();
226-
invoc.expansion_data.mark.set_expn_info(ext.expn_info(span, fast_print_path(path)));
226+
invoc.expansion_data.id.set_expn_info(ext.expn_info(span, fast_print_path(path)));
227227

228228
if let Res::Def(_, def_id) = res {
229229
if after_derive {
230230
self.session.span_err(span, "macro attributes must be placed before `#[derive]`");
231231
}
232-
self.macro_defs.insert(invoc.expansion_data.mark, def_id);
232+
self.macro_defs.insert(invoc.expansion_data.id, def_id);
233233
let normal_module_def_id =
234-
self.macro_def_scope(invoc.expansion_data.mark).normal_ancestor_id;
235-
self.definitions.add_parent_module_of_macro_def(invoc.expansion_data.mark,
234+
self.macro_def_scope(invoc.expansion_data.id).normal_ancestor_id;
235+
self.definitions.add_parent_module_of_macro_def(invoc.expansion_data.id,
236236
normal_module_def_id);
237237
}
238238

src/libsyntax/ast.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,11 @@ mod node_id_inner {
251251
pub use node_id_inner::NodeId;
252252

253253
impl NodeId {
254-
pub fn placeholder_from_mark(mark: ExpnId) -> Self {
255-
NodeId::from_u32(mark.as_u32())
254+
pub fn placeholder_from_expn_id(expn_id: ExpnId) -> Self {
255+
NodeId::from_u32(expn_id.as_u32())
256256
}
257257

258-
pub fn placeholder_to_mark(self) -> ExpnId {
258+
pub fn placeholder_to_expn_id(self) -> ExpnId {
259259
ExpnId::from_u32(self.as_u32())
260260
}
261261
}

src/libsyntax/ext/base.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ pub trait Resolver {
685685
fn get_module_scope(&mut self, id: ast::NodeId) -> ExpnId;
686686

687687
fn resolve_dollar_crates(&mut self);
688-
fn visit_ast_fragment_with_placeholders(&mut self, mark: ExpnId, fragment: &AstFragment,
688+
fn visit_ast_fragment_with_placeholders(&mut self, expn_id: ExpnId, fragment: &AstFragment,
689689
derives: &[ExpnId]);
690690
fn add_builtin(&mut self, ident: ast::Ident, ext: Lrc<SyntaxExtension>);
691691

@@ -705,7 +705,7 @@ pub struct ModuleData {
705705

706706
#[derive(Clone)]
707707
pub struct ExpansionData {
708-
pub mark: ExpnId,
708+
pub id: ExpnId,
709709
pub depth: usize,
710710
pub module: Rc<ModuleData>,
711711
pub directory_ownership: DirectoryOwnership,
@@ -735,7 +735,7 @@ impl<'a> ExtCtxt<'a> {
735735
root_path: PathBuf::new(),
736736
resolver,
737737
current_expansion: ExpansionData {
738-
mark: ExpnId::root(),
738+
id: ExpnId::root(),
739739
depth: 0,
740740
module: Rc::new(ModuleData { mod_path: Vec::new(), directory: PathBuf::new() }),
741741
directory_ownership: DirectoryOwnership::Owned { relative: None },
@@ -763,13 +763,13 @@ impl<'a> ExtCtxt<'a> {
763763
pub fn parse_sess(&self) -> &'a parse::ParseSess { self.parse_sess }
764764
pub fn cfg(&self) -> &ast::CrateConfig { &self.parse_sess.config }
765765
pub fn call_site(&self) -> Span {
766-
match self.current_expansion.mark.expn_info() {
766+
match self.current_expansion.id.expn_info() {
767767
Some(expn_info) => expn_info.call_site,
768768
None => DUMMY_SP,
769769
}
770770
}
771771
pub fn backtrace(&self) -> SyntaxContext {
772-
SyntaxContext::empty().apply_mark(self.current_expansion.mark)
772+
SyntaxContext::empty().apply_mark(self.current_expansion.id)
773773
}
774774

775775
/// Returns span for the macro which originally caused the current expansion to happen.
@@ -877,7 +877,7 @@ impl<'a> ExtCtxt<'a> {
877877
ast::Ident::from_str(st)
878878
}
879879
pub fn std_path(&self, components: &[Symbol]) -> Vec<ast::Ident> {
880-
let def_site = DUMMY_SP.apply_mark(self.current_expansion.mark);
880+
let def_site = DUMMY_SP.apply_mark(self.current_expansion.id);
881881
iter::once(Ident::new(kw::DollarCrate, def_site))
882882
.chain(components.iter().map(|&s| Ident::with_empty_ctxt(s)))
883883
.collect()
@@ -900,7 +900,7 @@ pub fn expr_to_spanned_string<'a>(
900900
err_msg: &str,
901901
) -> Result<Spanned<(Symbol, ast::StrStyle)>, Option<DiagnosticBuilder<'a>>> {
902902
// Update `expr.span`'s ctxt now in case expr is an `include!` macro invocation.
903-
expr.span = expr.span.apply_mark(cx.current_expansion.mark);
903+
expr.span = expr.span.apply_mark(cx.current_expansion.id);
904904

905905
// we want to be able to handle e.g., `concat!("foo", "bar")`
906906
cx.expander().visit_expr(&mut expr);

src/libsyntax/ext/derive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub fn add_derived_markers<T>(cx: &mut ExtCtxt<'_>, span: Span, traits: &[ast::P
5454
names.insert(unwrap_or!(path.segments.get(0), continue).ident.name);
5555
}
5656

57-
let span = span.fresh_expansion(cx.current_expansion.mark, ExpnInfo::allow_unstable(
57+
let span = span.fresh_expansion(cx.current_expansion.id, ExpnInfo::allow_unstable(
5858
ExpnKind::Macro(MacroKind::Derive, Symbol::intern(&pretty_name)), span,
5959
cx.parse_sess.edition, cx.allow_derive_markers.clone(),
6060
));

0 commit comments

Comments
 (0)