Skip to content

Commit 7811c97

Browse files
committed
Inline and remove fatal_no_raise.
This makes `Handler::fatal` more like `Handler::{err,warn,bug,note}`.
1 parent 3ab05ca commit 7811c97

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
@@ -1091,7 +1091,7 @@ impl Handler {
10911091

10921092
#[rustc_lint_diagnostics]
10931093
pub fn fatal(&self, msg: impl Into<DiagnosticMessage>) -> ! {
1094-
self.inner.borrow_mut().fatal_no_raise(msg).raise()
1094+
DiagnosticBuilder::<FatalError>::new(self, Fatal, msg).emit().raise()
10951095
}
10961096

10971097
#[rustc_lint_diagnostics]
@@ -1181,10 +1181,10 @@ impl Handler {
11811181
DiagnosticMessage::Str(warnings),
11821182
)),
11831183
(_, 0) => {
1184-
let _ = inner.fatal_no_raise(errors);
1184+
inner.emit_diagnostic(&mut Diagnostic::new(Fatal, errors));
11851185
}
11861186
(_, _) => {
1187-
let _ = inner.fatal_no_raise(format!("{errors}; {warnings}"));
1187+
inner.emit_diagnostic(&mut Diagnostic::new(Fatal, format!("{errors}; {warnings}")));
11881188
}
11891189
}
11901190

@@ -1592,13 +1592,6 @@ impl HandlerInner {
15921592
self.emit_diagnostic(&mut Diagnostic::new(FailureNote, msg));
15931593
}
15941594

1595-
// Note: unlike `Handler::fatal`, this doesn't return `!`, because that is
1596-
// inappropriate for some of its call sites.
1597-
fn fatal_no_raise(&mut self, msg: impl Into<DiagnosticMessage>) -> FatalError {
1598-
self.emit_diagnostic(&mut Diagnostic::new(Fatal, msg));
1599-
FatalError
1600-
}
1601-
16021595
fn flush_delayed(
16031596
&mut self,
16041597
bugs: impl IntoIterator<Item = DelayedDiagnostic>,

0 commit comments

Comments
 (0)