Skip to content

Commit 32a30ca

Browse files
committed
Use DefIdTree instead of re-implementing it.
1 parent 2c3b4ff commit 32a30ca

File tree

1 file changed

+2
-7
lines changed
  • compiler/rustc_ast_lowering/src

1 file changed

+2
-7
lines changed

compiler/rustc_ast_lowering/src/item.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc_hir::def::{DefKind, Res};
1313
use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID};
1414
use rustc_hir::PredicateOrigin;
1515
use rustc_index::vec::{Idx, IndexVec};
16-
use rustc_middle::ty::{ResolverAstLowering, TyCtxt};
16+
use rustc_middle::ty::{DefIdTree, ResolverAstLowering, TyCtxt};
1717
use rustc_span::source_map::DesugaringKind;
1818
use rustc_span::symbol::{kw, sym, Ident};
1919
use rustc_span::Span;
@@ -133,12 +133,7 @@ impl<'a, 'hir> ItemLowerer<'a, 'hir> {
133133
fn lower_assoc_item(&mut self, item: &AssocItem, ctxt: AssocCtxt) {
134134
let def_id = self.resolver.node_id_to_def_id[&item.id];
135135

136-
let parent_id = {
137-
let parent = self.tcx.hir().def_key(def_id).parent;
138-
let local_def_index = parent.unwrap();
139-
LocalDefId { local_def_index }
140-
};
141-
136+
let parent_id = self.tcx.local_parent(def_id);
142137
let parent_hir = self.lower_node(parent_id).unwrap();
143138
self.with_lctx(item.id, |lctx| {
144139
// Evaluate with the lifetimes in `params` in-scope.

0 commit comments

Comments
 (0)