]> git.lizzy.rs Git - rust.git/commitdiff
Verify predicates on RPIT and async opaques.
authorCamille GILLOT <gillot.camille@gmail.com>
Fri, 11 Nov 2022 18:07:03 +0000 (18:07 +0000)
committerCamille GILLOT <gillot.camille@gmail.com>
Sat, 12 Nov 2022 10:03:28 +0000 (10:03 +0000)
compiler/rustc_hir_analysis/src/collect/predicates_of.rs

index 5d1ca1cbd2389046881a349839011366507c796d..5f4127632e33bf6e4ee477a0350efd98e5747b5e 100644 (file)
@@ -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,