Skip to content

Commit

Permalink
XXX: emit_diagnostic_without_consuming
Browse files Browse the repository at this point in the history
  • Loading branch information
nnethercote committed Dec 20, 2023
1 parent e9fac72 commit aa1eeef
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1387,6 +1387,7 @@ impl DiagCtxtInner {
&mut self,
diagnostic: &mut Diagnostic,
) -> Option<ErrorGuaranteed> {
// njn: Level::Error { .. } | Level::Fatal
if matches!(diagnostic.level, Level::Error { .. } | Level::Fatal) && self.treat_err_as_bug()
{
diagnostic.level = Level::Bug;
Expand All @@ -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`
Expand All @@ -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,
Expand Down

0 comments on commit aa1eeef

Please sign in to comment.