diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-04 15:36:46 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-12-04 18:57:42 +1100 |
| commit | 7811c976d1a6b014bff0fdada7aaaa1774d31b82 (patch) | |
| tree | af1ebbec7f5dc0076240d8076517d80d863b7ef4 /compiler/rustc_errors/src | |
| parent | 3ab05caa4d196340dd61ce10543f64cb56878676 (diff) | |
| download | rust-7811c976d1a6b014bff0fdada7aaaa1774d31b82.tar.gz rust-7811c976d1a6b014bff0fdada7aaaa1774d31b82.zip | |
Inline and remove `fatal_no_raise`.
This makes `Handler::fatal` more like `Handler::{err,warn,bug,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 e6faefa612f..daa8a7706eb 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1091,7 +1091,7 @@ impl Handler { #[rustc_lint_diagnostics] pub fn fatal(&self, msg: impl Into<DiagnosticMessage>) -> ! { - self.inner.borrow_mut().fatal_no_raise(msg).raise() + DiagnosticBuilder::<FatalError>::new(self, Fatal, msg).emit().raise() } #[rustc_lint_diagnostics] @@ -1181,10 +1181,10 @@ impl Handler { DiagnosticMessage::Str(warnings), )), (_, 0) => { - let _ = inner.fatal_no_raise(errors); + inner.emit_diagnostic(&mut Diagnostic::new(Fatal, errors)); } (_, _) => { - let _ = inner.fatal_no_raise(format!("{errors}; {warnings}")); + inner.emit_diagnostic(&mut Diagnostic::new(Fatal, format!("{errors}; {warnings}"))); } } @@ -1592,13 +1592,6 @@ impl HandlerInner { self.emit_diagnostic(&mut Diagnostic::new(FailureNote, msg)); } - // Note: unlike `Handler::fatal`, this doesn't return `!`, because that is - // inappropriate for some of its call sites. - fn fatal_no_raise(&mut self, msg: impl Into<DiagnosticMessage>) -> FatalError { - self.emit_diagnostic(&mut Diagnostic::new(Fatal, msg)); - FatalError - } - fn flush_delayed( &mut self, bugs: impl IntoIterator<Item = DelayedDiagnostic>, |
