From 96509b483589e8d9ae98d1c075dccef184c8be30 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Sat, 27 Mar 2021 22:45:01 -0400 Subject: Make `Diagnostic::span_fatal` unconditionally raise an error It had no callers which didn't immediately call `raise()`, and this unifies the behavior with `Session`. --- compiler/rustc_errors/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'compiler/rustc_errors/src') diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 6aee769298b..cbfb5f951b2 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -634,9 +634,9 @@ impl Handler { DiagnosticBuilder::new(self, Level::Note, msg) } - pub fn span_fatal(&self, span: impl Into, msg: &str) -> FatalError { + pub fn span_fatal(&self, span: impl Into, msg: &str) -> ! { self.emit_diag_at_span(Diagnostic::new(Fatal, msg), span); - FatalError + FatalError.raise() } pub fn span_fatal_with_code( @@ -644,9 +644,9 @@ impl Handler { span: impl Into, msg: &str, code: DiagnosticId, - ) -> FatalError { + ) -> ! { self.emit_diag_at_span(Diagnostic::new_with_code(Fatal, Some(code), msg), span); - FatalError + FatalError.raise() } pub fn span_err(&self, span: impl Into, msg: &str) { -- cgit 1.4.1-3-g733a5 From ebbc94957555350cdc71c4c853de430119f59f9f Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Sat, 27 Mar 2021 22:58:25 -0400 Subject: Note why `Handler::fatal` is different from `Sesssion::fatal` --- compiler/rustc_errors/src/lib.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'compiler/rustc_errors/src') diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index cbfb5f951b2..dc1664bb2ba 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -692,6 +692,7 @@ impl Handler { db } + // NOTE: intentionally doesn't raise an error so rustc_codegen_ssa only reports fatal errors in the main thread pub fn fatal(&self, msg: &str) -> FatalError { self.inner.borrow_mut().fatal(msg) } -- cgit 1.4.1-3-g733a5