diff options
| author | Luqman Aden <me@luqman.ca> | 2022-08-07 22:41:40 -0700 |
|---|---|---|
| committer | Luqman Aden <me@luqman.ca> | 2022-08-08 11:52:04 -0700 |
| commit | fb8636fc4826dbab5a728cb75bff0e9295c8e59a (patch) | |
| tree | ba193d6604e0c1266986cd8b25191a1c7053b291 | |
| parent | 93ab13b4e894ab74258c40aaf29872db2b17b6b4 (diff) | |
| download | rust-fb8636fc4826dbab5a728cb75bff0e9295c8e59a.tar.gz rust-fb8636fc4826dbab5a728cb75bff0e9295c8e59a.zip | |
Set tainted errors bit before emitting coerce suggestions.
| -rw-r--r-- | compiler/rustc_typeck/src/check/coercion.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_typeck/src/check/coercion.rs b/compiler/rustc_typeck/src/check/coercion.rs index 21d0a7869d6..8ab9f77d0ea 100644 --- a/compiler/rustc_typeck/src/check/coercion.rs +++ b/compiler/rustc_typeck/src/check/coercion.rs @@ -1479,6 +1479,10 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> { } } Err(coercion_error) => { + // Mark that we've failed to coerce the types here to suppress + // any superfluous errors we might encounter while trying to + // emit or provide suggestions on how to fix the initial error. + fcx.set_tainted_by_errors(); let (expected, found) = if label_expression_as_expected { // In the case where this is a "forced unit", like // `break`, we want to call the `()` "expected" |
