Track more diagnostics in rustc_expand

This commit is contained in:
Maybe Waffle 2023-06-07 17:17:27 +00:00
parent e94bda3bf1
commit c38d80ee9f

View File

@ -1108,6 +1108,7 @@ pub fn expansion_cause(&self) -> Option<Span> {
}
#[rustc_lint_diagnostics]
#[track_caller]
pub fn struct_span_err<S: Into<MultiSpan>>(
&self,
sp: S,
@ -1116,6 +1117,7 @@ pub fn struct_span_err<S: Into<MultiSpan>>(
self.sess.parse_sess.span_diagnostic.struct_span_err(sp, msg)
}
#[track_caller]
pub fn create_err(
&self,
err: impl IntoDiagnostic<'a>,
@ -1123,6 +1125,7 @@ pub fn create_err(
self.sess.create_err(err)
}
#[track_caller]
pub fn emit_err(&self, err: impl IntoDiagnostic<'a>) -> ErrorGuaranteed {
self.sess.emit_err(err)
}
@ -1133,10 +1136,12 @@ pub fn emit_err(&self, err: impl IntoDiagnostic<'a>) -> ErrorGuaranteed {
/// Compilation will be stopped in the near future (at the end of
/// the macro expansion phase).
#[rustc_lint_diagnostics]
#[track_caller]
pub fn span_err<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<DiagnosticMessage>) {
self.sess.parse_sess.span_diagnostic.span_err(sp, msg);
}
#[rustc_lint_diagnostics]
#[track_caller]
pub fn span_warn<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<DiagnosticMessage>) {
self.sess.parse_sess.span_diagnostic.span_warn(sp, msg);
}