Skip to content

Commit fb8636f

Browse files
committed
Set tainted errors bit before emitting coerce suggestions.
1 parent 93ab13b commit fb8636f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler/rustc_typeck/src/check/coercion.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,10 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
14791479
}
14801480
}
14811481
Err(coercion_error) => {
1482+
// Mark that we've failed to coerce the types here to suppress
1483+
// any superfluous errors we might encounter while trying to
1484+
// emit or provide suggestions on how to fix the initial error.
1485+
fcx.set_tainted_by_errors();
14821486
let (expected, found) = if label_expression_as_expected {
14831487
// In the case where this is a "forced unit", like
14841488
// `break`, we want to call the `()` "expected"

0 commit comments

Comments
 (0)