1
Fork 0

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:
bors 2024-03-11 00:34:44 +00:00
commit cd81f5b27e
78 changed files with 567 additions and 586 deletions

View file

@ -9,7 +9,7 @@ use rustc_ast::{ast, AttrKind, AttrStyle, Attribute, LitKind};
use rustc_ast::{MetaItemKind, MetaItemLit, NestedMetaItem};
use rustc_data_structures::fx::FxHashMap;
use rustc_errors::StashKey;
use rustc_errors::{Applicability, DiagCtxt, IntoDiagnosticArg, MultiSpan};
use rustc_errors::{Applicability, DiagCtxt, IntoDiagArg, MultiSpan};
use rustc_feature::{AttributeDuplicates, AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP};
use rustc_hir as hir;
use rustc_hir::def_id::LocalModDefId;
@ -79,14 +79,14 @@ pub(crate) enum ProcMacroKind {
Attribute,
}
impl IntoDiagnosticArg for ProcMacroKind {
fn into_diagnostic_arg(self) -> rustc_errors::DiagArgValue {
impl IntoDiagArg for ProcMacroKind {
fn into_diag_arg(self) -> rustc_errors::DiagArgValue {
match self {
ProcMacroKind::Attribute => "attribute proc macro",
ProcMacroKind::Derive => "derive proc macro",
ProcMacroKind::FunctionLike => "function-like proc macro",
}
.into_diagnostic_arg()
.into_diag_arg()
}
}

View file

@ -6,8 +6,8 @@ use std::{
use crate::fluent_generated as fluent;
use rustc_ast::Label;
use rustc_errors::{
codes::*, AddToDiagnostic, Applicability, Diag, DiagCtxt, DiagSymbolList, EmissionGuarantee,
IntoDiagnostic, Level, MultiSpan, SubdiagMessageOp,
codes::*, Applicability, Diag, DiagCtxt, DiagSymbolList, Diagnostic, EmissionGuarantee, Level,
MultiSpan, SubdiagMessageOp, Subdiagnostic,
};
use rustc_hir::{self as hir, ExprKind, Target};
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
@ -862,9 +862,9 @@ pub struct ItemFollowingInnerAttr {
pub kind: &'static str,
}
impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for InvalidAttrAtCrateLevel {
impl<G: EmissionGuarantee> Diagnostic<'_, G> for InvalidAttrAtCrateLevel {
#[track_caller]
fn into_diagnostic(self, dcx: &'_ DiagCtxt, level: Level) -> Diag<'_, G> {
fn into_diag(self, dcx: &'_ DiagCtxt, level: Level) -> Diag<'_, G> {
let mut diag = Diag::new(dcx, level, fluent::passes_invalid_attr_at_crate_level);
diag.span(self.span);
diag.arg("name", self.name);
@ -1012,9 +1012,9 @@ pub struct BreakNonLoop<'a> {
pub break_expr_span: Span,
}
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'_, G> for BreakNonLoop<'a> {
impl<'a, G: EmissionGuarantee> Diagnostic<'_, G> for BreakNonLoop<'a> {
#[track_caller]
fn into_diagnostic(self, dcx: &DiagCtxt, level: Level) -> Diag<'_, G> {
fn into_diag(self, dcx: &DiagCtxt, level: Level) -> Diag<'_, G> {
let mut diag = Diag::new(dcx, level, fluent::passes_break_non_loop);
diag.span(self.span);
diag.code(E0571);
@ -1156,9 +1156,9 @@ pub struct NakedFunctionsAsmBlock {
pub non_asms: Vec<Span>,
}
impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for NakedFunctionsAsmBlock {
impl<G: EmissionGuarantee> Diagnostic<'_, G> for NakedFunctionsAsmBlock {
#[track_caller]
fn into_diagnostic(self, dcx: &DiagCtxt, level: Level) -> Diag<'_, G> {
fn into_diag(self, dcx: &DiagCtxt, level: Level) -> Diag<'_, G> {
let mut diag = Diag::new(dcx, level, fluent::passes_naked_functions_asm_block);
diag.span(self.span);
diag.code(E0787);
@ -1267,9 +1267,9 @@ pub struct NoMainErr {
pub add_teach_note: bool,
}
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for NoMainErr {
impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for NoMainErr {
#[track_caller]
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> {
fn into_diag(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> {
let mut diag = Diag::new(dcx, level, fluent::passes_no_main_function);
diag.span(DUMMY_SP);
diag.code(E0601);
@ -1325,9 +1325,9 @@ pub struct DuplicateLangItem {
pub(crate) duplicate: Duplicate,
}
impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for DuplicateLangItem {
impl<G: EmissionGuarantee> Diagnostic<'_, G> for DuplicateLangItem {
#[track_caller]
fn into_diagnostic(self, dcx: &DiagCtxt, level: Level) -> Diag<'_, G> {
fn into_diag(self, dcx: &DiagCtxt, level: Level) -> Diag<'_, G> {
let mut diag = Diag::new(
dcx,
level,
@ -1751,8 +1751,8 @@ pub struct UnusedVariableStringInterp {
pub hi: Span,
}
impl AddToDiagnostic for UnusedVariableStringInterp {
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
impl Subdiagnostic for UnusedVariableStringInterp {
fn add_to_diag_with<G: EmissionGuarantee, F: SubdiagMessageOp<G>>(
self,
diag: &mut Diag<'_, G>,
_f: F,