diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-04 14:48:11 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-04 18:57:42 +1100 |
| commit | 3ab05caa4d196340dd61ce10543f64cb56878676 (patch) | |
| tree | 15261e01503f5e9ddef1eb31c7145dbcdcc524ea /compiler/rustc_errors/src | |
| parent | 883bdb7fda9b2eda5e3c1846ed653e7edf4936c4 (diff) | |
| download | rust-3ab05caa4d196340dd61ce10543f64cb56878676.tar.gz rust-3ab05caa4d196340dd61ce10543f64cb56878676.zip | |
Make `Handler::{err,bug}` more like `Handler::{warn,note}`.
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/lib.rs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 11ac5239445..e6faefa612f 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1096,10 +1096,7 @@ impl Handler { #[rustc_lint_diagnostics] pub fn err(&self, msg: impl Into<DiagnosticMessage>) -> ErrorGuaranteed { - self.inner - .borrow_mut() - .emit_diagnostic(&mut Diagnostic::new(Error { lint: false }, msg)) - .unwrap() + DiagnosticBuilder::<ErrorGuaranteed>::new(self, Error { lint: false }, msg).emit() } #[rustc_lint_diagnostics] @@ -1113,7 +1110,8 @@ impl Handler { } 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] @@ -1601,11 +1599,6 @@ impl HandlerInner { FatalError } - fn bug(&mut self, msg: impl Into<DiagnosticMessage>) -> ! { - self.emit_diagnostic(&mut Diagnostic::new(Bug, msg)); - panic::panic_any(ExplicitBug); - } - fn flush_delayed( &mut self, bugs: impl IntoIterator<Item = DelayedDiagnostic>, |
