about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-10-04 11:56:45 -0400
committerMichael Goulet <michael@errs.io>2024-10-10 06:07:51 -0400
commit09da2ebd63107997e1319c2a076021660285ef40 (patch)
tree2dc30ea748cdd7a540383679eaa94e45f5b5b6b2 /compiler
parentdf1b5d3cc2117f1ee96abca25678bc5f5604d450 (diff)
Move ty::Error branch into super_combine_tys
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_infer/src/infer/relate/combine.rs5
-rw-r--r--compiler/rustc_infer/src/infer/relate/type_relating.rs5
2 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_infer/src/infer/relate/combine.rs b/compiler/rustc_infer/src/infer/relate/combine.rs
index c4f5a85a8be..f879fbc5578 100644
--- a/compiler/rustc_infer/src/infer/relate/combine.rs
+++ b/compiler/rustc_infer/src/infer/relate/combine.rs
@@ -43,6 +43,11 @@ impl<'tcx> InferCtxt<'tcx> {
         debug_assert!(!b.has_escaping_bound_vars());
 
         match (a.kind(), b.kind()) {
+            (&ty::Error(e), _) | (_, &ty::Error(e)) => {
+                self.set_tainted_by_errors(e);
+                return Ok(Ty::new_error(self.tcx, e));
+            }
+
             // Relate integral variables to other types
             (&ty::Infer(ty::IntVar(a_id)), &ty::Infer(ty::IntVar(b_id))) => {
                 self.inner.borrow_mut().int_unification_table().union(a_id, b_id);
diff --git a/compiler/rustc_infer/src/infer/relate/type_relating.rs b/compiler/rustc_infer/src/infer/relate/type_relating.rs
index 4b4b13e919c..d99acabb825 100644
--- a/compiler/rustc_infer/src/infer/relate/type_relating.rs
+++ b/compiler/rustc_infer/src/infer/relate/type_relating.rs
@@ -183,11 +183,6 @@ impl<'tcx> TypeRelation<TyCtxt<'tcx>> for TypeRelating<'_, 'tcx> {
                 )?;
             }
 
-            (&ty::Error(e), _) | (_, &ty::Error(e)) => {
-                infcx.set_tainted_by_errors(e);
-                return Ok(Ty::new_error(self.cx(), e));
-            }
-
             (
                 &ty::Alias(ty::Opaque, ty::AliasTy { def_id: a_def_id, .. }),
                 &ty::Alias(ty::Opaque, ty::AliasTy { def_id: b_def_id, .. }),