Reorder has_future_breakage
handling.
This will enable additional refactorings.
This commit is contained in:
parent
272e60bd3e
commit
c81767e7cb
@ -1356,6 +1356,14 @@ impl DiagCtxtInner {
|
|||||||
fn emit_diagnostic(&mut self, mut diagnostic: DiagInner) -> Option<ErrorGuaranteed> {
|
fn emit_diagnostic(&mut self, mut diagnostic: DiagInner) -> Option<ErrorGuaranteed> {
|
||||||
assert!(diagnostic.level.can_be_top_or_sub().0);
|
assert!(diagnostic.level.can_be_top_or_sub().0);
|
||||||
|
|
||||||
|
if diagnostic.has_future_breakage() {
|
||||||
|
// Future breakages aren't emitted if they're Level::Allow,
|
||||||
|
// but they still need to be constructed and stashed below,
|
||||||
|
// so they'll trigger the must_produce_diag check.
|
||||||
|
self.suppressed_expected_diag = true;
|
||||||
|
self.future_breakage_diagnostics.push(diagnostic.clone());
|
||||||
|
}
|
||||||
|
|
||||||
if let Expect(expect_id) | ForceWarning(Some(expect_id)) = diagnostic.level {
|
if let Expect(expect_id) | ForceWarning(Some(expect_id)) = diagnostic.level {
|
||||||
// The `LintExpectationId` can be stable or unstable depending on when it was created.
|
// The `LintExpectationId` can be stable or unstable depending on when it was created.
|
||||||
// Diagnostics created before the definition of `HirId`s are unstable and can not yet
|
// Diagnostics created before the definition of `HirId`s are unstable and can not yet
|
||||||
@ -1369,14 +1377,6 @@ impl DiagCtxtInner {
|
|||||||
self.fulfilled_expectations.insert(expect_id.normalize());
|
self.fulfilled_expectations.insert(expect_id.normalize());
|
||||||
}
|
}
|
||||||
|
|
||||||
if diagnostic.has_future_breakage() {
|
|
||||||
// Future breakages aren't emitted if they're Level::Allow,
|
|
||||||
// but they still need to be constructed and stashed below,
|
|
||||||
// so they'll trigger the must_produce_diag check.
|
|
||||||
self.suppressed_expected_diag = true;
|
|
||||||
self.future_breakage_diagnostics.push(diagnostic.clone());
|
|
||||||
}
|
|
||||||
|
|
||||||
match diagnostic.level {
|
match diagnostic.level {
|
||||||
Fatal | Error if self.treat_next_err_as_bug() => {
|
Fatal | Error if self.treat_next_err_as_bug() => {
|
||||||
// `Fatal` and `Error` can be promoted to `Bug`.
|
// `Fatal` and `Error` can be promoted to `Bug`.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user