1
Fork 0

Auto merge of #100754 - davidtwco:translation-incremental, r=compiler-errors

incremental: migrate diagnostics

- Apply the diagnostic migration lints to more functions on `Session`, namely: `span_warn`, `span_warn_with_code`, `warn` `note_without_error`, `span_note_without_error`, `struct_note_without_error`.
- Add impls of `IntoDiagnosticArg` for `std::io::Error`, `std::path::Path` and `std::path::PathBuf`.
- Migrate the `rustc_incremental` crate's diagnostics to translatable diagnostic structs.

r? `@compiler-errors`
cc #100717
This commit is contained in:
bors 2023-01-31 10:20:58 +00:00
commit a64ef7d07d
49 changed files with 1158 additions and 429 deletions

View file

@ -17,7 +17,7 @@ use rustc_middle::ty::TyCtxt;
use rustc_session::parse::feature_err;
use rustc_span::{sym, Span, Symbol};
use crate::errors::ExprNotAllowedInContext;
use crate::errors::{ExprNotAllowedInContext, SkippingConstChecks};
/// An expression that is not *always* legal in a const context.
#[derive(Clone, Copy)]
@ -124,7 +124,7 @@ impl<'tcx> CheckConstVisitor<'tcx> {
// corresponding feature gate. This encourages nightly users to use feature gates when
// possible.
None if tcx.sess.opts.unstable_opts.unleash_the_miri_inside_of_you => {
tcx.sess.span_warn(span, "skipping const checks");
tcx.sess.emit_warning(SkippingConstChecks { span });
return;
}

View file

@ -1565,3 +1565,10 @@ pub(crate) struct ProcMacroUnsafe {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(passes_skipping_const_checks)]
pub struct SkippingConstChecks {
#[primary_span]
pub span: Span,
}