Don't repeatedly duplicate TAIT lifetimes for each subsequently nested TAIT
This commit is contained in:
parent
00ed4edb44
commit
ffb4206577
3 changed files with 88 additions and 7 deletions
|
@ -195,16 +195,19 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
|
|||
}
|
||||
Some(fn_def_id.to_def_id())
|
||||
}
|
||||
ItemKind::OpaqueTy(hir::OpaqueTy {
|
||||
origin: hir::OpaqueTyOrigin::TyAlias { .. },
|
||||
ItemKind::OpaqueTy(&hir::OpaqueTy {
|
||||
origin: hir::OpaqueTyOrigin::TyAlias { parent, in_assoc_ty },
|
||||
..
|
||||
}) => {
|
||||
let parent_id = tcx.hir().get_parent_item(hir_id);
|
||||
assert_ne!(parent_id, hir::CRATE_OWNER_ID);
|
||||
debug!("generics_of: parent of opaque ty {:?} is {:?}", def_id, parent_id);
|
||||
if in_assoc_ty {
|
||||
assert!(matches!(tcx.def_kind(parent), DefKind::AssocTy));
|
||||
} else {
|
||||
assert!(matches!(tcx.def_kind(parent), DefKind::TyAlias));
|
||||
}
|
||||
debug!("generics_of: parent of opaque ty {:?} is {:?}", def_id, parent);
|
||||
// Opaque types are always nested within another item, and
|
||||
// inherit the generics of the item.
|
||||
Some(parent_id.to_def_id())
|
||||
Some(parent.to_def_id())
|
||||
}
|
||||
_ => None,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue