diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index d13cc27d2df5..b790ee1eaea1 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -3532,7 +3532,6 @@ impl<'a> LoweringContext<'a> { name: ident.name, vis, attrs, - id: i.id, hir_id, span: i.span, body, diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs index 04eec88004aa..588b986aad29 100644 --- a/src/librustc/hir/map/collector.rs +++ b/src/librustc/hir/map/collector.rs @@ -507,7 +507,8 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { } fn visit_macro_def(&mut self, macro_def: &'hir MacroDef) { - let def_index = self.definitions.opt_def_index(macro_def.id).unwrap(); + let node_id = self.hir_to_node_id[¯o_def.hir_id]; + let def_index = self.definitions.opt_def_index(node_id).unwrap(); self.with_dep_node_owner(def_index, macro_def, |this| { this.insert(macro_def.span, macro_def.hir_id, Node::MacroDef(macro_def)); diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 052802810f09..5339d0fa0ecd 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -390,7 +390,7 @@ impl<'hir> Map<'hir> { Some(Def::Local(local.id)) } Node::MacroDef(macro_def) => { - Some(Def::Macro(self.local_def_id(macro_def.id), + Some(Def::Macro(self.local_def_id_from_hir_id(macro_def.hir_id), MacroKind::Bang)) } Node::GenericParam(param) => { diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index e1c744fd28fb..1d7b28baed7f 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -809,7 +809,6 @@ pub struct MacroDef { pub name: Name, pub vis: Visibility, pub attrs: HirVec, - pub id: NodeId, pub hir_id: HirId, pub span: Span, pub body: TokenStream, diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index c761b722e0ba..ef13638ceb70 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -406,7 +406,6 @@ impl_stable_hash_for!(struct hir::MacroDef { name, vis, attrs, - id, hir_id, span, legacy, diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index ef2cca708d17..79457cc028a7 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -1279,7 +1279,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { /// Serialize the text of exported macros fn encode_info_for_macro_def(&mut self, macro_def: &hir::MacroDef) -> Entry<'tcx> { use syntax::print::pprust; - let def_id = self.tcx.hir().local_def_id(macro_def.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(macro_def.hir_id); Entry { kind: EntryKind::MacroDef(self.lazy(&MacroDef { body: pprust::tts_to_string(¯o_def.body.trees().collect::>()), @@ -1680,7 +1680,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for EncodeVisitor<'a, 'b, 'tcx> { self.index.encode_info_for_ty(ty); } fn visit_macro_def(&mut self, macro_def: &'tcx hir::MacroDef) { - let def_id = self.index.tcx.hir().local_def_id(macro_def.id); + let def_id = self.index.tcx.hir().local_def_id_from_hir_id(macro_def.hir_id); self.index.record(def_id, IsolatedEncoder::encode_info_for_macro_def, macro_def); } } diff --git a/src/librustc_metadata/index_builder.rs b/src/librustc_metadata/index_builder.rs index 9aff1133ea92..3e2571fc0b39 100644 --- a/src/librustc_metadata/index_builder.rs +++ b/src/librustc_metadata/index_builder.rs @@ -185,7 +185,7 @@ macro_rules! read_hir { ($t:ty) => { impl<'tcx> DepGraphRead for &'tcx $t { fn read(&self, tcx: TyCtxt<'_, '_, '_>) { - tcx.hir().read(self.id); + tcx.hir().read_by_hir_id(self.hir_id); } } } diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 825721a1a96a..830ede751fbc 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -695,18 +695,20 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { } fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef) { + let node_id = self.tcx.hir().hir_to_node_id(md.hir_id); + if md.legacy { - self.update(md.id, Some(AccessLevel::Public)); + self.update(node_id, Some(AccessLevel::Public)); return } let module_did = ty::DefIdTree::parent( self.tcx, - self.tcx.hir().local_def_id(md.id) + self.tcx.hir().local_def_id_from_hir_id(md.hir_id) ).unwrap(); let mut module_id = self.tcx.hir().as_local_node_id(module_did).unwrap(); let level = if md.vis.node.is_pub() { self.get(module_id) } else { None }; - let level = self.update(md.id, level); + let level = self.update(node_id, level); if level.is_none() { return }