Skip to content

Commit a0f5431

Browse files
committed
Move code around.
No point computing `warnings` and `errors` if we're going to return early before they're used.
1 parent 2aac288 commit a0f5431

File tree

1 file changed

+4
-3
lines changed
  • compiler/rustc_errors/src

1 file changed

+4
-3
lines changed

compiler/rustc_errors/src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,10 @@ impl DiagCtxt {
981981

982982
inner.emit_stashed_diagnostics();
983983

984+
if inner.treat_err_as_bug() {
985+
return;
986+
}
987+
984988
let warnings = match inner.deduplicated_warn_count {
985989
0 => Cow::from(""),
986990
1 => Cow::from("1 warning emitted"),
@@ -991,9 +995,6 @@ impl DiagCtxt {
991995
1 => Cow::from("aborting due to 1 previous error"),
992996
count => Cow::from(format!("aborting due to {count} previous errors")),
993997
};
994-
if inner.treat_err_as_bug() {
995-
return;
996-
}
997998

998999
match (errors.len(), warnings.len()) {
9991000
(0, 0) => return,

0 commit comments

Comments
 (0)