Skip to content

Commit 3ab05ca

Browse files
committed
Make Handler::{err,bug} more like Handler::{warn,note}.
1 parent 883bdb7 commit 3ab05ca

File tree

1 file changed

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

1 file changed

+3
-10
lines changed

compiler/rustc_errors/src/lib.rs

+3-10
Original file line numberDiff line numberDiff line change
@@ -1096,10 +1096,7 @@ impl Handler {
10961096

10971097
#[rustc_lint_diagnostics]
10981098
pub fn err(&self, msg: impl Into<DiagnosticMessage>) -> ErrorGuaranteed {
1099-
self.inner
1100-
.borrow_mut()
1101-
.emit_diagnostic(&mut Diagnostic::new(Error { lint: false }, msg))
1102-
.unwrap()
1099+
DiagnosticBuilder::<ErrorGuaranteed>::new(self, Error { lint: false }, msg).emit()
11031100
}
11041101

11051102
#[rustc_lint_diagnostics]
@@ -1113,7 +1110,8 @@ impl Handler {
11131110
}
11141111

11151112
pub fn bug(&self, msg: impl Into<DiagnosticMessage>) -> ! {
1116-
self.inner.borrow_mut().bug(msg)
1113+
DiagnosticBuilder::<diagnostic_builder::Bug>::new(self, Bug, msg).emit();
1114+
panic::panic_any(ExplicitBug);
11171115
}
11181116

11191117
#[inline]
@@ -1601,11 +1599,6 @@ impl HandlerInner {
16011599
FatalError
16021600
}
16031601

1604-
fn bug(&mut self, msg: impl Into<DiagnosticMessage>) -> ! {
1605-
self.emit_diagnostic(&mut Diagnostic::new(Bug, msg));
1606-
panic::panic_any(ExplicitBug);
1607-
}
1608-
16091602
fn flush_delayed(
16101603
&mut self,
16111604
bugs: impl IntoIterator<Item = DelayedDiagnostic>,

0 commit comments

Comments
 (0)