From: Camille GILLOT Date: Fri, 11 Nov 2022 18:07:03 +0000 (+0000) Subject: Verify predicates on RPIT and async opaques. X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=49a5aa4f0cd2e21f071067e7a0c53474ba9e86c6;p=rust.git Verify predicates on RPIT and async opaques. --- diff --git a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs index 5d1ca1cbd23..5f4127632e3 100644 --- a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs @@ -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,