Skip to content

Commit b2a856e

Browse files
committed
Return ErrorGuaranteed from span_err_with_code methods.
`ErrorGuaranteed` should be used for all error methods involving the `Error` level, e.g. as is done for the corresponding `span_err` methods.
1 parent f7e3d05 commit b2a856e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

compiler/rustc_errors/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -970,11 +970,12 @@ impl Handler {
970970
span: impl Into<MultiSpan>,
971971
msg: impl Into<DiagnosticMessage>,
972972
code: DiagnosticId,
973-
) {
973+
) -> ErrorGuaranteed {
974974
self.emit_diag_at_span(
975975
Diagnostic::new_with_code(Error { lint: false }, Some(code), msg),
976976
span,
977-
);
977+
)
978+
.unwrap()
978979
}
979980

980981
#[rustc_lint_diagnostics]

compiler/rustc_session/src/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ impl Session {
478478
sp: S,
479479
msg: impl Into<DiagnosticMessage>,
480480
code: DiagnosticId,
481-
) {
481+
) -> ErrorGuaranteed {
482482
self.diagnostic().span_err_with_code(sp, msg, code)
483483
}
484484
#[rustc_lint_diagnostics]

0 commit comments

Comments
 (0)