Set tainted errors bit before emitting coerce suggestions.

This commit is contained in:
Luqman Aden 2022-08-07 22:41:40 -07:00
parent 93ab13b4e8
commit fb8636fc48

View File

@ -1479,6 +1479,10 @@ pub(crate) fn coerce_inner<'a>(
}
}
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"