Skip to content

Commit

Permalink
Rollup merge of #112396 - WaffleLapkin:track_more_diagnostics, r=comp…
Browse files Browse the repository at this point in the history
…iler-errors

Track more diagnostics in `rustc_expand`

I wish we could lint this somehow...
  • Loading branch information
GuillaumeGomez authored Jun 8, 2023
2 parents 80c2648 + c38d80e commit b3d1a83
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compiler/rustc_expand/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,7 @@ impl<'a> ExtCtxt<'a> {
}

#[rustc_lint_diagnostics]
#[track_caller]
pub fn struct_span_err<S: Into<MultiSpan>>(
&self,
sp: S,
Expand All @@ -1118,13 +1119,15 @@ impl<'a> ExtCtxt<'a> {
self.sess.parse_sess.span_diagnostic.struct_span_err(sp, msg)
}

#[track_caller]
pub fn create_err(
&self,
err: impl IntoDiagnostic<'a>,
) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
self.sess.create_err(err)
}

#[track_caller]
pub fn emit_err(&self, err: impl IntoDiagnostic<'a>) -> ErrorGuaranteed {
self.sess.emit_err(err)
}
Expand All @@ -1135,10 +1138,12 @@ impl<'a> ExtCtxt<'a> {
/// 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);
}
Expand Down

0 comments on commit b3d1a83

Please sign in to comment.