1
Fork 0

Auto merge of #106910 - aliemjay:alias-ty-in-regionck, r=oli-obk

even more unify Projection/Opaque handling in region outlives code

edit: This continues ate the same pace as #106829. New changes are described in https://github.com/rust-lang/rust/pull/106910#issuecomment-1383251254.

~This touches `OutlivesBound`, `Component`, `GenericKind` enums.~

r? `@oli-obk` (because of overlap with #95474)
This commit is contained in:
bors 2023-01-19 14:05:07 +00:00
commit 19423b5944
13 changed files with 108 additions and 151 deletions

View file

@ -80,7 +80,7 @@ pub(crate) fn insert_outlives_predicate<'tcx>(
.or_insert(span);
}
Component::Alias(kind, alias) => {
Component::Alias(alias_ty) => {
// This would either arise from something like:
//
// ```
@ -99,13 +99,13 @@ pub(crate) fn insert_outlives_predicate<'tcx>(
//
// Here we want to add an explicit `where <T as Iterator>::Item: 'a`
// or `Opaque<T>: 'a` depending on the alias kind.
let ty: Ty<'tcx> = tcx.mk_ty(ty::Alias(kind, alias));
let ty = alias_ty.to_ty(tcx);
required_predicates
.entry(ty::OutlivesPredicate(ty.into(), outlived_region))
.or_insert(span);
}
Component::EscapingProjection(_) => {
Component::EscapingAlias(_) => {
// As above, but the projection involves
// late-bound regions. Therefore, the WF
// requirement is not checked in type definition