Prefer item-local tainting checks over global error count checks

This commit is contained in:
Oli Scherer 2024-07-01 10:31:41 +00:00
parent 9d5da39b3a
commit a5d37238a1
2 changed files with 2 additions and 2 deletions

View File

@ -708,7 +708,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// else an error would have been flagged by the // else an error would have been flagged by the
// `loops` pass for using break with an expression // `loops` pass for using break with an expression
// where you are not supposed to. // where you are not supposed to.
assert!(expr_opt.is_none() || self.dcx().has_errors().is_some()); assert!(expr_opt.is_none() || self.tainted_by_errors().is_some());
} }
// If we encountered a `break`, then (no surprise) it may be possible to break from the // If we encountered a `break`, then (no surprise) it may be possible to break from the

View File

@ -1652,7 +1652,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
self.warn_if_unreachable(stmt.hir_id, stmt.span, "statement"); self.warn_if_unreachable(stmt.hir_id, stmt.span, "statement");
// Hide the outer diverging and `has_errors` flags. // Hide the outer diverging flags.
let old_diverges = self.diverges.replace(Diverges::Maybe); let old_diverges = self.diverges.replace(Diverges::Maybe);
match stmt.kind { match stmt.kind {