Rollup merge of #100261 - luqmana:suggestions-overflow, r=lcnr
Set tainted errors bit before emitting coerce suggestions. Fixes #100246. #89576 basically got 99% of the way there but the match typechecking code (which calls `coerce_inner`) also needed a similar fix.
This commit is contained in:
commit
2be32e8e9b
3 changed files with 47 additions and 0 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue