about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorLukas Markeffsky <@>2025-01-02 18:31:40 +0100
committerLukas Markeffsky <@>2025-01-02 19:16:00 +0100
commit93bb639ad6b02a68e1681b96351badf8b6a33fa3 (patch)
treea67fcd78691918f643ff1f237b309a9675cad96d /compiler
parentbf6f8a4d328f7f3b0f6ea8205ad28591cc11aafd (diff)
downloadrust-93bb639ad6b02a68e1681b96351badf8b6a33fa3.tar.gz
rust-93bb639ad6b02a68e1681b96351badf8b6a33fa3.zip
taint fcx on selection errors during unsizing
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_hir_typeck/src/coercion.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_hir_typeck/src/coercion.rs b/compiler/rustc_hir_typeck/src/coercion.rs
index 60e3c0166b9..bd26be11279 100644
--- a/compiler/rustc_hir_typeck/src/coercion.rs
+++ b/compiler/rustc_hir_typeck/src/coercion.rs
@@ -666,7 +666,12 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
 
                 // Dyn-compatibility violations or miscellaneous.
                 Err(err) => {
-                    self.err_ctxt().report_selection_error(obligation.clone(), &obligation, &err);
+                    let guar = self.err_ctxt().report_selection_error(
+                        obligation.clone(),
+                        &obligation,
+                        &err,
+                    );
+                    self.fcx.set_tainted_by_errors(guar);
                     // Treat this like an obligation and follow through
                     // with the unsizing - the lack of a coercion should
                     // be silent, as it causes a type mismatch later.