about summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src
diff options
context:
space:
mode:
authorAli MJ Al-Nasrawy <alimjalnasrawy@gmail.com>2024-03-19 19:23:47 +0000
committerAli MJ Al-Nasrawy <alimjalnasrawy@gmail.com>2024-03-28 06:00:25 +0000
commitc337825d6dae4b2ada4b358b95aa6ee730a49677 (patch)
tree9569bcdc9b0b874b774636899f4665e40232197c /compiler/rustc_borrowck/src
parent4ecdf5ff00a9af18160bc7214cbcb8a6a1e01d10 (diff)
ignore error params
Diffstat (limited to 'compiler/rustc_borrowck/src')
-rw-r--r--compiler/rustc_borrowck/src/region_infer/opaque_types.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs
index 0474dd18d45..84bacabc14e 100644
--- a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs
+++ b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs
@@ -478,6 +478,10 @@ fn check_opaque_type_parameter_valid<'tcx>(
             let opaque_param = opaque_generics.param_at(i, tcx);
             let kind = opaque_param.kind.descr();
 
+            if let Err(guar) = opaque_env.param_is_error(i) {
+                return Err(guar);
+            }
+
             return Err(tcx.dcx().emit_err(NonGenericOpaqueTypeParam {
                 ty: arg,
                 kind,
@@ -536,6 +540,10 @@ impl<'tcx> LazyOpaqueTyEnv<'tcx> {
         canonical_args[param1] == canonical_args[param2]
     }
 
+    pub fn param_is_error(&self, param_index: usize) -> Result<(), ErrorGuaranteed> {
+        self.get_canonical_args()[param_index].error_reported()
+    }
+
     fn get_canonical_args(&self) -> ty::GenericArgsRef<'tcx> {
         use rustc_hir as hir;
         use rustc_infer::infer::outlives::env::OutlivesEnvironment;