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.
This commit is contained in:
Nicholas Nethercote 2023-11-30 13:57:35 +11:00
parent f7e3d05aa7
commit b2a856ea3c
2 changed files with 4 additions and 3 deletions

View File

@ -970,11 +970,12 @@ pub fn span_err_with_code(
span: impl Into<MultiSpan>,
msg: impl Into<DiagnosticMessage>,
code: DiagnosticId,
) {
) -> ErrorGuaranteed {
self.emit_diag_at_span(
Diagnostic::new_with_code(Error { lint: false }, Some(code), msg),
span,
);
)
.unwrap()
}
#[rustc_lint_diagnostics]

View File

@ -478,7 +478,7 @@ pub fn span_err_with_code<S: Into<MultiSpan>>(
sp: S,
msg: impl Into<DiagnosticMessage>,
code: DiagnosticId,
) {
) -> ErrorGuaranteed {
self.diagnostic().span_err_with_code(sp, msg, code)
}
#[rustc_lint_diagnostics]