From aa1eeef845e3f1de0c6d98f33f8ea5aecd20a118 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 20 Dec 2023 16:51:31 +1100 Subject: [PATCH] XXX: emit_diagnostic_without_consuming --- compiler/rustc_errors/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 795b3f02a9ae..67bf848b851c 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1387,6 +1387,7 @@ impl DiagCtxtInner { &mut self, diagnostic: &mut Diagnostic, ) -> Option { + // njn: Level::Error { .. } | Level::Fatal if matches!(diagnostic.level, Level::Error { .. } | Level::Fatal) && self.treat_err_as_bug() { diagnostic.level = Level::Bug; @@ -1396,11 +1397,13 @@ impl DiagCtxtInner { // Diagnostics created before the definition of `HirId`s are unstable and can not yet // be stored. Instead, they are buffered until the `LintExpectationId` is replaced by // a stable one by the `LintLevelsBuilder`. + // njn: Level::Expect(id) | Level::Warning(Some(id)) => Some(*id), if let Some(LintExpectationId::Unstable { .. }) = diagnostic.level.get_expectation_id() { self.unstable_expect_diagnostics.push(diagnostic.clone()); return None; } + // njn: Level::DelayedBug if diagnostic.level == Level::DelayedBug { // FIXME(eddyb) this should check for `has_errors` and stop pushing // once *any* errors were emitted (and truncate `span_delayed_bugs` @@ -1416,6 +1419,7 @@ impl DiagCtxtInner { } } + // njn: self.code... Error only? if diagnostic.has_future_breakage() { // Future breakages aren't emitted if they're Level::Allowed, // but they still need to be constructed and stashed below,