Skip to content

Commit 124bfc9

Browse files
committed
Remove parent def lookup hack that is no longer needed
The tcx.parent tree appears to be correct now.
1 parent 9b82646 commit 124bfc9

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

compiler/rustc_hir_analysis/src/collect/generics_of.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,6 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
7777
// stable enough and does not need a feature gate anymore.
7878
Node::AnonConst(_) => {
7979
let parent_did = tcx.parent(def_id.to_def_id());
80-
81-
// We don't do this unconditionally because the `DefId` parent of an anon const
82-
// might be an implicitly created closure during `async fn` desugaring. This would
83-
// have the wrong generics.
84-
//
85-
// i.e. `async fn foo<'a>() { let a = [(); { 1 + 2 }]; bar().await() }`
86-
// would implicitly have a closure in its body that would be the parent of
87-
// the `{ 1 + 2 }` anon const. This closure's generics is simply a witness
88-
// instead of `['a]`.
89-
let parent_did = if let DefKind::AnonConst = tcx.def_kind(parent_did) {
90-
parent_did
91-
} else {
92-
tcx.hir_get_parent_item(hir_id).to_def_id()
93-
};
9480
debug!(?parent_did);
9581

9682
let mut in_param_ty = false;

0 commit comments

Comments
 (0)