mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 01:13:11 +00:00
Verify predicates on RPIT and async opaques.
This commit is contained in:
parent
da9dca7040
commit
49a5aa4f0c
@ -106,26 +106,6 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP
|
||||
is_trait = Some(ty::TraitRef::identity(tcx, def_id));
|
||||
*generics
|
||||
}
|
||||
ItemKind::OpaqueTy(OpaqueTy {
|
||||
origin: hir::OpaqueTyOrigin::AsyncFn(..) | hir::OpaqueTyOrigin::FnReturn(..),
|
||||
..
|
||||
}) => {
|
||||
// return-position impl trait
|
||||
//
|
||||
// We don't inherit predicates from the parent here:
|
||||
// If we have, say `fn f<'a, T: 'a>() -> impl Sized {}`
|
||||
// then the return type is `f::<'static, T>::{{opaque}}`.
|
||||
//
|
||||
// If we inherited the predicates of `f` then we would
|
||||
// require that `T: 'static` to show that the return
|
||||
// type is well-formed.
|
||||
//
|
||||
// The only way to have something with this opaque type
|
||||
// is from the return type of the containing function,
|
||||
// which will ensure that the function's predicates
|
||||
// hold.
|
||||
return ty::GenericPredicates { parent: None, predicates: &[] };
|
||||
}
|
||||
ItemKind::OpaqueTy(OpaqueTy {
|
||||
ref generics,
|
||||
origin: hir::OpaqueTyOrigin::TyAlias,
|
||||
|
Loading…
Reference in New Issue
Block a user