Skip to content

Commit a29ceb9

Browse files
committed
hir: remove NodeId from ImplItem
1 parent c2e517e commit a29ceb9

File tree

15 files changed

+30
-27
lines changed

15 files changed

+30
-27
lines changed

src/librustc/hir/intravisit.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,6 @@ pub fn walk_trait_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, trait_item_ref:
878878
pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplItem) {
879879
// N.B., deliberately force a compilation error if/when new fields are added.
880880
let ImplItem {
881-
id: _,
882881
hir_id: _,
883882
ident,
884883
ref vis,

src/librustc/hir/lowering.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3426,7 +3426,6 @@ impl<'a> LoweringContext<'a> {
34263426
};
34273427

34283428
hir::ImplItem {
3429-
id: node_id,
34303429
hir_id,
34313430
ident: i.ident,
34323431
attrs: self.lower_attrs(&i.attrs),

src/librustc/hir/map/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
398398

399399
fn visit_impl_item(&mut self, ii: &'hir ImplItem) {
400400
debug_assert_eq!(ii.hir_id.owner,
401-
self.definitions.opt_def_index(ii.id).unwrap());
401+
self.definitions.opt_def_index(self.hir_to_node_id[&ii.hir_id]).unwrap());
402402
self.with_dep_node_owner(ii.hir_id.owner, ii, |this| {
403403
this.insert(ii.span, ii.hir_id, Node::ImplItem(ii));
404404

src/librustc/hir/map/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ impl<'hir> Map<'hir> {
357357
}
358358
}
359359
Node::ImplItem(item) => {
360-
let def_id = self.local_def_id(item.id);
360+
let def_id = self.local_def_id_from_hir_id(item.hir_id);
361361
match item.node {
362362
ImplItemKind::Const(..) => Some(Def::AssociatedConst(def_id)),
363363
ImplItemKind::Method(..) => Some(Def::Method(def_id)),

src/librustc/hir/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1710,7 +1710,6 @@ pub struct ImplItemId {
17101710
/// Represents anything within an `impl` block
17111711
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
17121712
pub struct ImplItem {
1713-
pub id: NodeId,
17141713
pub ident: Ident,
17151714
pub hir_id: HirId,
17161715
pub vis: Visibility,

src/librustc/ich/impls_hir.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::ImplItem {
703703
hcx: &mut StableHashingContext<'a>,
704704
hasher: &mut StableHasher<W>) {
705705
let hir::ImplItem {
706-
id: _,
707706
hir_id: _,
708707
ident,
709708
ref vis,

src/librustc/middle/reachable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fn method_might_be_inlined<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
4848
impl_item: &hir::ImplItem,
4949
impl_src: DefId) -> bool {
5050
let codegen_fn_attrs = tcx.codegen_fn_attrs(impl_item.hir_id.owner_def_id());
51-
let generics = tcx.generics_of(tcx.hir().local_def_id(impl_item.id));
51+
let generics = tcx.generics_of(tcx.hir().local_def_id_from_hir_id(impl_item.hir_id));
5252
if codegen_fn_attrs.requests_inline() || generics.requires_monomorphization(tcx) {
5353
return true
5454
}

src/librustc/middle/stability.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,8 @@ impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> {
355355
}
356356

357357
fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem) {
358-
let impl_def_id = self.tcx.hir().local_def_id(self.tcx.hir().get_parent(ii.id));
358+
let impl_def_id = self.tcx.hir().local_def_id_from_hir_id(
359+
self.tcx.hir().get_parent_item(ii.hir_id));
359360
if self.tcx.impl_trait_ref(impl_def_id).is_none() {
360361
self.check_missing_stability(ii.hir_id, ii.span, "item");
361362
}

src/librustc_lint/builtin.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,11 +1112,12 @@ impl LintPass for UnreachablePub {
11121112
}
11131113

11141114
impl UnreachablePub {
1115-
fn perform_lint(&self, cx: &LateContext<'_, '_>, what: &str, id: ast::NodeId,
1115+
fn perform_lint(&self, cx: &LateContext<'_, '_>, what: &str, id: hir::HirId,
11161116
vis: &hir::Visibility, span: Span, exportable: bool) {
11171117
let mut applicability = Applicability::MachineApplicable;
1118+
let node_id = cx.tcx.hir().hir_to_node_id(id);
11181119
match vis.node {
1119-
hir::VisibilityKind::Public if !cx.access_levels.is_reachable(id) => {
1120+
hir::VisibilityKind::Public if !cx.access_levels.is_reachable(node_id) => {
11201121
if span.ctxt().outer().expn_info().is_some() {
11211122
applicability = Applicability::MaybeIncorrect;
11221123
}
@@ -1148,20 +1149,20 @@ impl UnreachablePub {
11481149

11491150
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnreachablePub {
11501151
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) {
1151-
self.perform_lint(cx, "item", item.id, &item.vis, item.span, true);
1152+
self.perform_lint(cx, "item", item.hir_id, &item.vis, item.span, true);
11521153
}
11531154

11541155
fn check_foreign_item(&mut self, cx: &LateContext<'_, '_>, foreign_item: &hir::ForeignItem) {
1155-
self.perform_lint(cx, "item", foreign_item.id, &foreign_item.vis,
1156+
self.perform_lint(cx, "item", foreign_item.hir_id, &foreign_item.vis,
11561157
foreign_item.span, true);
11571158
}
11581159

11591160
fn check_struct_field(&mut self, cx: &LateContext<'_, '_>, field: &hir::StructField) {
1160-
self.perform_lint(cx, "field", field.id, &field.vis, field.span, false);
1161+
self.perform_lint(cx, "field", field.hir_id, &field.vis, field.span, false);
11611162
}
11621163

11631164
fn check_impl_item(&mut self, cx: &LateContext<'_, '_>, impl_item: &hir::ImplItem) {
1164-
self.perform_lint(cx, "item", impl_item.id, &impl_item.vis, impl_item.span, false);
1165+
self.perform_lint(cx, "item", impl_item.hir_id, &impl_item.vis, impl_item.span, false);
11651166
}
11661167
}
11671168

src/librustc_mir/monomorphize/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> {
10061006
fn visit_impl_item(&mut self, ii: &'v hir::ImplItem) {
10071007
match ii.node {
10081008
hir::ImplItemKind::Method(hir::MethodSig { .. }, _) => {
1009-
let def_id = self.tcx.hir().local_def_id(ii.id);
1009+
let def_id = self.tcx.hir().local_def_id_from_hir_id(ii.hir_id);
10101010
self.push_if_root(def_id);
10111011
}
10121012
_ => { /* Nothing to do here */ }

0 commit comments

Comments
 (0)