diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 6bd87f54140e..0233cccbf434 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -970,11 +970,12 @@ impl Handler { span: impl Into, msg: impl Into, code: DiagnosticId, - ) { + ) -> ErrorGuaranteed { self.emit_diag_at_span( Diagnostic::new_with_code(Error { lint: false }, Some(code), msg), span, - ); + ) + .unwrap() } #[rustc_lint_diagnostics] diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index b20017557bbd..8f3c0d76a9a7 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -478,7 +478,7 @@ impl Session { sp: S, msg: impl Into, code: DiagnosticId, - ) { + ) -> ErrorGuaranteed { self.diagnostic().span_err_with_code(sp, msg, code) } #[rustc_lint_diagnostics]