Skip to content

Commit a5d3723

Browse files
committed
Prefer item-local tainting checks over global error count checks
1 parent 9d5da39 commit a5d3723

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler/rustc_hir_typeck/src/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
708708
// else an error would have been flagged by the
709709
// `loops` pass for using break with an expression
710710
// where you are not supposed to.
711-
assert!(expr_opt.is_none() || self.dcx().has_errors().is_some());
711+
assert!(expr_opt.is_none() || self.tainted_by_errors().is_some());
712712
}
713713

714714
// If we encountered a `break`, then (no surprise) it may be possible to break from the

compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1652,7 +1652,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
16521652

16531653
self.warn_if_unreachable(stmt.hir_id, stmt.span, "statement");
16541654

1655-
// Hide the outer diverging and `has_errors` flags.
1655+
// Hide the outer diverging flags.
16561656
let old_diverges = self.diverges.replace(Diverges::Maybe);
16571657

16581658
match stmt.kind {

0 commit comments

Comments
 (0)