about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-12-30 18:40:16 +0000
committerMichael Goulet <michael@errs.io>2022-12-30 19:53:34 +0000
commitf6b45e399e5c75429e66b11760e97d56fc010091 (patch)
tree9e0cb5cd52e060cb4a88e7b5ecee6976e474367b /compiler
parent7c991868c60a4afc1ee6334b912ea96061a2c98d (diff)
downloadrust-f6b45e399e5c75429e66b11760e97d56fc010091.tar.gz
rust-f6b45e399e5c75429e66b11760e97d56fc010091.zip
Suppress errors due to TypeError not coercing with inference variables
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_hir_typeck/src/coercion.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_hir_typeck/src/coercion.rs b/compiler/rustc_hir_typeck/src/coercion.rs
index b0cd4a16e98..3fb14e31ea1 100644
--- a/compiler/rustc_hir_typeck/src/coercion.rs
+++ b/compiler/rustc_hir_typeck/src/coercion.rs
@@ -171,6 +171,10 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
 
         // Just ignore error types.
         if a.references_error() || b.references_error() {
+            // Best-effort try to unify these types -- we're already on the error path,
+            // so this will have the side-effect of making sure we have no ambiguities
+            // due to `[type error]` and `_` not coercing together.
+            let _ = self.commit_if_ok(|_| self.at(&self.cause, self.param_env).eq(a, b));
             return success(vec![], self.fcx.tcx.ty_error(), vec![]);
         }