Move DelayedBug
handling into the match
.
It results in a tiny bit of duplication (another `self.treat_next_err_as_bug()` condition) but I think it's worth it to get more code into the main `match`.
This commit is contained in:
parent
ecd3718bc0
commit
272e60bd3e
@ -1377,20 +1377,24 @@ impl DiagCtxtInner {
|
||||
self.future_breakage_diagnostics.push(diagnostic.clone());
|
||||
}
|
||||
|
||||
// Note that because this comes before the `match` below,
|
||||
// `-Zeagerly-emit-delayed-bugs` continues to work even after we've
|
||||
// issued an error and stopped recording new delayed bugs.
|
||||
if diagnostic.level == DelayedBug && self.flags.eagerly_emit_delayed_bugs {
|
||||
diagnostic.level = Error;
|
||||
}
|
||||
|
||||
match diagnostic.level {
|
||||
// This must come after the possible promotion of `DelayedBug` to
|
||||
// `Error` above.
|
||||
Fatal | Error if self.treat_next_err_as_bug() => {
|
||||
// `Fatal` and `Error` can be promoted to `Bug`.
|
||||
diagnostic.level = Bug;
|
||||
}
|
||||
DelayedBug => {
|
||||
// Note that because we check these conditions first,
|
||||
// `-Zeagerly-emit-delayed-bugs` and `-Ztreat-err-as-bug`
|
||||
// continue to work even after we've issued an error and
|
||||
// stopped recording new delayed bugs.
|
||||
if self.flags.eagerly_emit_delayed_bugs {
|
||||
// `DelayedBug` can be promoted to `Error` or `Bug`.
|
||||
if self.treat_next_err_as_bug() {
|
||||
diagnostic.level = Bug;
|
||||
} else {
|
||||
diagnostic.level = Error;
|
||||
}
|
||||
} else {
|
||||
// If we have already emitted at least one error, we don't need
|
||||
// to record the delayed bug, because it'll never be used.
|
||||
return if let Some(guar) = self.has_errors() {
|
||||
@ -1407,6 +1411,7 @@ impl DiagCtxtInner {
|
||||
Some(guar)
|
||||
};
|
||||
}
|
||||
}
|
||||
Warning if !self.flags.can_emit_warnings => {
|
||||
if diagnostic.has_future_breakage() {
|
||||
TRACK_DIAGNOSTIC(diagnostic, &mut |_| None);
|
||||
|
Loading…
x
Reference in New Issue
Block a user