Make Handler::{err,bug} more like Handler::{warn,note}.

This commit is contained in:
Nicholas Nethercote 2023-12-04 14:48:11 +11:00
parent 883bdb7fda
commit 3ab05caa4d

View File

@ -1096,10 +1096,7 @@ pub fn fatal(&self, msg: impl Into<DiagnosticMessage>) -> ! {
#[rustc_lint_diagnostics] #[rustc_lint_diagnostics]
pub fn err(&self, msg: impl Into<DiagnosticMessage>) -> ErrorGuaranteed { pub fn err(&self, msg: impl Into<DiagnosticMessage>) -> ErrorGuaranteed {
self.inner DiagnosticBuilder::<ErrorGuaranteed>::new(self, Error { lint: false }, msg).emit()
.borrow_mut()
.emit_diagnostic(&mut Diagnostic::new(Error { lint: false }, msg))
.unwrap()
} }
#[rustc_lint_diagnostics] #[rustc_lint_diagnostics]
@ -1113,7 +1110,8 @@ pub fn note(&self, msg: impl Into<DiagnosticMessage>) {
} }
pub fn bug(&self, msg: impl Into<DiagnosticMessage>) -> ! { pub fn bug(&self, msg: impl Into<DiagnosticMessage>) -> ! {
self.inner.borrow_mut().bug(msg) DiagnosticBuilder::<diagnostic_builder::Bug>::new(self, Bug, msg).emit();
panic::panic_any(ExplicitBug);
} }
#[inline] #[inline]
@ -1601,11 +1599,6 @@ fn fatal_no_raise(&mut self, msg: impl Into<DiagnosticMessage>) -> FatalError {
FatalError FatalError
} }
fn bug(&mut self, msg: impl Into<DiagnosticMessage>) -> ! {
self.emit_diagnostic(&mut Diagnostic::new(Bug, msg));
panic::panic_any(ExplicitBug);
}
fn flush_delayed( fn flush_delayed(
&mut self, &mut self,
bugs: impl IntoIterator<Item = DelayedDiagnostic>, bugs: impl IntoIterator<Item = DelayedDiagnostic>,