1
Fork 0

Rename IntoDiagnostic as Diagnostic.

To match `derive(Diagnostic)`.

Also rename `into_diagnostic` as `into_diag`.
This commit is contained in:
Nicholas Nethercote 2024-03-06 11:02:56 +11:00
parent a09b1d33a7
commit 7a294e998b
28 changed files with 146 additions and 164 deletions

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::*, AddToDiagnostic, Applicability, Diag, DiagCtxt, DiagSymbolList, Diagnostic,
EmissionGuarantee, Level, MultiSpan, SubdiagMessageOp,
};
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,