about summary refs log tree commit diff
diff options
context:
space:
mode:
authorlcnr <rust@lcnr.de>2024-02-27 17:30:24 +0100
committerlcnr <rust@lcnr.de>2024-02-27 17:30:24 +0100
commit300cffa2d5b4bb4a22dfae3b85f788e8ad882243 (patch)
treeeb5bb7f239c9ca26f920b1ca4f5fe0cc22bc2c44
parent6591c80eea51bfc019972845c08fdb78f1238760 (diff)
downloadrust-300cffa2d5b4bb4a22dfae3b85f788e8ad882243.tar.gz
rust-300cffa2d5b4bb4a22dfae3b85f788e8ad882243.zip
yeet now unnecessary special-case
-rw-r--r--compiler/rustc_hir_analysis/src/check/check.rs23
1 files changed, 5 insertions, 18 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs
index cf42a705236..21b074099e2 100644
--- a/compiler/rustc_hir_analysis/src/check/check.rs
+++ b/compiler/rustc_hir_analysis/src/check/check.rs
@@ -402,24 +402,11 @@ fn check_opaque_meets_bounds<'tcx>(
         let guar = infcx.err_ctxt().report_fulfillment_errors(errors);
         return Err(guar);
     }
-    match origin {
-        // Nested opaque types occur only in associated types:
-        // ` type Opaque<T> = impl Trait<&'static T, AssocTy = impl Nested>; `
-        // They can only be referenced as `<Opaque<T> as Trait<&'static T>>::AssocTy`.
-        // We don't have to check them here because their well-formedness follows from the WF of
-        // the projection input types in the defining- and use-sites.
-        hir::OpaqueTyOrigin::TyAlias { .. }
-            if tcx.def_kind(tcx.parent(def_id.to_def_id())) == DefKind::OpaqueTy => {}
-        // Can have different predicates to their defining use
-        hir::OpaqueTyOrigin::TyAlias { .. }
-        | hir::OpaqueTyOrigin::FnReturn(..)
-        | hir::OpaqueTyOrigin::AsyncFn(..) => {
-            let wf_tys = ocx.assumed_wf_types_and_report_errors(param_env, defining_use_anchor)?;
-            let implied_bounds = infcx.implied_bounds_tys(param_env, def_id, &wf_tys);
-            let outlives_env = OutlivesEnvironment::with_bounds(param_env, implied_bounds);
-            ocx.resolve_regions_and_report_errors(defining_use_anchor, &outlives_env)?;
-        }
-    }
+
+    let wf_tys = ocx.assumed_wf_types_and_report_errors(param_env, defining_use_anchor)?;
+    let implied_bounds = infcx.implied_bounds_tys(param_env, def_id, &wf_tys);
+    let outlives_env = OutlivesEnvironment::with_bounds(param_env, implied_bounds);
+    ocx.resolve_regions_and_report_errors(defining_use_anchor, &outlives_env)?;
 
     if let hir::OpaqueTyOrigin::FnReturn(..) | hir::OpaqueTyOrigin::AsyncFn(..) = origin {
         // HACK: this should also fall through to the hidden type check below, but the original