Auto merge of #122132 - nnethercote:diag-renaming3, r=nnethercote
Diagnostic renaming 3 A sequel to https://github.com/rust-lang/rust/pull/121780. r? `@davidtwco`
This commit is contained in:
commit
cd81f5b27e
78 changed files with 567 additions and 586 deletions
|
@ -1,6 +1,6 @@
|
|||
use std::mem;
|
||||
|
||||
use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, IntoDiagnostic, IntoDiagnosticArg};
|
||||
use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, Diagnostic, IntoDiagArg};
|
||||
use rustc_hir::CRATE_HIR_ID;
|
||||
use rustc_middle::mir::AssertKind;
|
||||
use rustc_middle::query::TyCtxtAt;
|
||||
|
@ -40,10 +40,10 @@ impl MachineStopType for ConstEvalErrKind {
|
|||
RecursiveStatic | ConstAccessesMutGlobal | ModifiedGlobal => {}
|
||||
AssertFailure(kind) => kind.add_args(adder),
|
||||
Panic { msg, line, col, file } => {
|
||||
adder("msg".into(), msg.into_diagnostic_arg());
|
||||
adder("file".into(), file.into_diagnostic_arg());
|
||||
adder("line".into(), line.into_diagnostic_arg());
|
||||
adder("col".into(), col.into_diagnostic_arg());
|
||||
adder("msg".into(), msg.into_diag_arg());
|
||||
adder("file".into(), file.into_diag_arg());
|
||||
adder("line".into(), line.into_diag_arg());
|
||||
adder("col".into(), col.into_diag_arg());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ pub(super) fn report<'tcx, C, F, E>(
|
|||
where
|
||||
C: FnOnce() -> (Span, Vec<FrameNote>),
|
||||
F: FnOnce(Span, Vec<FrameNote>) -> E,
|
||||
E: IntoDiagnostic<'tcx>,
|
||||
E: Diagnostic<'tcx>,
|
||||
{
|
||||
// Special handling for certain errors
|
||||
match error {
|
||||
|
@ -168,7 +168,7 @@ pub(super) fn lint<'tcx, 'mir, L>(
|
|||
lint: &'static rustc_session::lint::Lint,
|
||||
decorator: impl FnOnce(Vec<errors::FrameNote>) -> L,
|
||||
) where
|
||||
L: for<'a> rustc_errors::DecorateLint<'a, ()>,
|
||||
L: for<'a> rustc_errors::LintDiagnostic<'a, ()>,
|
||||
{
|
||||
let (span, frames) = get_span_and_frames(tcx, machine);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::borrow::Cow;
|
||||
|
||||
use rustc_errors::{
|
||||
codes::*, Diag, DiagArgValue, DiagCtxt, DiagMessage, EmissionGuarantee, IntoDiagnostic, Level,
|
||||
codes::*, Diag, DiagArgValue, DiagCtxt, DiagMessage, Diagnostic, EmissionGuarantee, Level,
|
||||
};
|
||||
use rustc_hir::ConstContext;
|
||||
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
||||
|
@ -239,7 +239,7 @@ pub(crate) struct NonConstImplNote {
|
|||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic, PartialEq, Eq, Clone)]
|
||||
#[derive(Subdiagnostic, Clone)]
|
||||
#[note(const_eval_frame_note)]
|
||||
pub struct FrameNote {
|
||||
#[primary_span]
|
||||
|
@ -858,8 +858,7 @@ impl<'tcx> ReportErrorExt for InvalidProgramInfo<'tcx> {
|
|||
InvalidProgramInfo::Layout(e) => {
|
||||
// The level doesn't matter, `dummy_diag` is consumed without it being used.
|
||||
let dummy_level = Level::Bug;
|
||||
let dummy_diag: Diag<'_, ()> =
|
||||
e.into_diagnostic().into_diagnostic(diag.dcx, dummy_level);
|
||||
let dummy_diag: Diag<'_, ()> = e.into_diagnostic().into_diag(diag.dcx, dummy_level);
|
||||
for (name, val) in dummy_diag.args.iter() {
|
||||
diag.arg(name.clone(), val.clone());
|
||||
}
|
||||
|
@ -887,8 +886,8 @@ impl ReportErrorExt for ResourceExhaustionInfo {
|
|||
fn add_args<G: EmissionGuarantee>(self, _: &mut Diag<'_, G>) {}
|
||||
}
|
||||
|
||||
impl rustc_errors::IntoDiagnosticArg for InternKind {
|
||||
fn into_diagnostic_arg(self) -> DiagArgValue {
|
||||
impl rustc_errors::IntoDiagArg for InternKind {
|
||||
fn into_diag_arg(self) -> DiagArgValue {
|
||||
DiagArgValue::Str(Cow::Borrowed(match self {
|
||||
InternKind::Static(Mutability::Not) => "static",
|
||||
InternKind::Static(Mutability::Mut) => "static_mut",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue