Skip to content

Commit

Permalink
Prefer item-local tainting checks over global error count checks
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Jul 1, 2024
1 parent 9d5da39 commit a5d3723
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// else an error would have been flagged by the
// `loops` pass for using break with an expression
// 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
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1652,7 +1652,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

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);

match stmt.kind {
Expand Down

0 comments on commit a5d3723

Please sign in to comment.