From d0ef108ce991db652ac19f652af70d194920aa26 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 23 Feb 2024 15:34:39 +1100 Subject: [PATCH] Rename `DiagnosticArgFromDisplay` as `DiagArgFromDisplay`. --- compiler/rustc_ast_lowering/src/errors.rs | 5 ++--- compiler/rustc_ast_lowering/src/lib.rs | 6 +++--- compiler/rustc_errors/src/diagnostic_impls.rs | 12 ++++++------ compiler/rustc_errors/src/lib.rs | 4 ++-- compiler/rustc_privacy/src/errors.rs | 14 +++++++------- 5 files changed, 20 insertions(+), 21 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/errors.rs b/compiler/rustc_ast_lowering/src/errors.rs index e3a6d9d4c21..eafbe3462bb 100644 --- a/compiler/rustc_ast_lowering/src/errors.rs +++ b/compiler/rustc_ast_lowering/src/errors.rs @@ -1,6 +1,5 @@ use rustc_errors::{ - codes::*, AddToDiagnostic, Diag, DiagnosticArgFromDisplay, EmissionGuarantee, - SubdiagnosticMessageOp, + codes::*, AddToDiagnostic, Diag, DiagArgFromDisplay, EmissionGuarantee, SubdiagnosticMessageOp, }; use rustc_macros::{Diagnostic, Subdiagnostic}; use rustc_span::{symbol::Ident, Span, Symbol}; @@ -95,7 +94,7 @@ pub enum AssocTyParenthesesSub { pub struct MisplacedImplTrait<'a> { #[primary_span] pub span: Span, - pub position: DiagnosticArgFromDisplay<'a>, + pub position: DiagArgFromDisplay<'a>, } #[derive(Diagnostic)] diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index a5be91bb872..087d240b0d5 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -51,7 +51,7 @@ use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::sorted_map::SortedMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::Lrc; -use rustc_errors::{DiagCtxt, DiagnosticArgFromDisplay, StashKey}; +use rustc_errors::{DiagArgFromDisplay, DiagCtxt, StashKey}; use rustc_hir as hir; use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res}; use rustc_hir::def_id::{LocalDefId, LocalDefIdMap, CRATE_DEF_ID, LOCAL_CRATE}; @@ -1473,7 +1473,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { .create_feature_err( MisplacedImplTrait { span: t.span, - position: DiagnosticArgFromDisplay(&position), + position: DiagArgFromDisplay(&position), }, feature, ) @@ -1483,7 +1483,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { ImplTraitContext::Disallowed(position) => { let guar = self.dcx().emit_err(MisplacedImplTrait { span: t.span, - position: DiagnosticArgFromDisplay(&position), + position: DiagArgFromDisplay(&position), }); hir::TyKind::Err(guar) } diff --git a/compiler/rustc_errors/src/diagnostic_impls.rs b/compiler/rustc_errors/src/diagnostic_impls.rs index ec43a0e54e4..a245fef3343 100644 --- a/compiler/rustc_errors/src/diagnostic_impls.rs +++ b/compiler/rustc_errors/src/diagnostic_impls.rs @@ -20,23 +20,23 @@ use std::num::ParseIntError; use std::path::{Path, PathBuf}; use std::process::ExitStatus; -pub struct DiagnosticArgFromDisplay<'a>(pub &'a dyn fmt::Display); +pub struct DiagArgFromDisplay<'a>(pub &'a dyn fmt::Display); -impl IntoDiagnosticArg for DiagnosticArgFromDisplay<'_> { +impl IntoDiagnosticArg for DiagArgFromDisplay<'_> { fn into_diagnostic_arg(self) -> DiagArgValue { self.0.to_string().into_diagnostic_arg() } } -impl<'a> From<&'a dyn fmt::Display> for DiagnosticArgFromDisplay<'a> { +impl<'a> From<&'a dyn fmt::Display> for DiagArgFromDisplay<'a> { fn from(t: &'a dyn fmt::Display) -> Self { - DiagnosticArgFromDisplay(t) + DiagArgFromDisplay(t) } } -impl<'a, T: fmt::Display> From<&'a T> for DiagnosticArgFromDisplay<'a> { +impl<'a, T: fmt::Display> From<&'a T> for DiagArgFromDisplay<'a> { fn from(t: &'a T) -> Self { - DiagnosticArgFromDisplay(t) + DiagArgFromDisplay(t) } } diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index b4d50b6859a..c4f92095a8b 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -42,8 +42,8 @@ pub use diagnostic::{ IntoDiagnosticArg, StringPart, Subdiag, SubdiagnosticMessageOp, }; pub use diagnostic_impls::{ - DiagnosticArgFromDisplay, DiagnosticSymbolList, ExpectedLifetimeParameter, - IndicateAnonymousLifetime, SingleLabelManySpans, + DiagArgFromDisplay, DiagnosticSymbolList, ExpectedLifetimeParameter, IndicateAnonymousLifetime, + SingleLabelManySpans, }; pub use emitter::ColorConfig; pub use rustc_error_messages::{ diff --git a/compiler/rustc_privacy/src/errors.rs b/compiler/rustc_privacy/src/errors.rs index 01c6d18c0e1..ee04c335f2b 100644 --- a/compiler/rustc_privacy/src/errors.rs +++ b/compiler/rustc_privacy/src/errors.rs @@ -1,4 +1,4 @@ -use rustc_errors::{codes::*, DiagnosticArgFromDisplay}; +use rustc_errors::{codes::*, DiagArgFromDisplay}; use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; use rustc_span::{Span, Symbol}; @@ -36,7 +36,7 @@ pub struct ItemIsPrivate<'a> { #[label] pub span: Span, pub kind: &'a str, - pub descr: DiagnosticArgFromDisplay<'a>, + pub descr: DiagArgFromDisplay<'a>, } #[derive(Diagnostic)] @@ -55,7 +55,7 @@ pub struct InPublicInterface<'a> { pub span: Span, pub vis_descr: &'static str, pub kind: &'a str, - pub descr: DiagnosticArgFromDisplay<'a>, + pub descr: DiagArgFromDisplay<'a>, #[label(privacy_visibility_label)] pub vis_span: Span, } @@ -72,7 +72,7 @@ pub struct ReportEffectiveVisibility { #[diag(privacy_from_private_dep_in_public_interface)] pub struct FromPrivateDependencyInPublicInterface<'a> { pub kind: &'a str, - pub descr: DiagnosticArgFromDisplay<'a>, + pub descr: DiagArgFromDisplay<'a>, pub krate: Symbol, } @@ -82,7 +82,7 @@ pub struct UnnameableTypesLint<'a> { #[label] pub span: Span, pub kind: &'a str, - pub descr: DiagnosticArgFromDisplay<'a>, + pub descr: DiagArgFromDisplay<'a>, pub reachable_vis: &'a str, pub reexported_vis: &'a str, } @@ -96,11 +96,11 @@ pub struct PrivateInterfacesOrBoundsLint<'a> { #[label(privacy_item_label)] pub item_span: Span, pub item_kind: &'a str, - pub item_descr: DiagnosticArgFromDisplay<'a>, + pub item_descr: DiagArgFromDisplay<'a>, pub item_vis_descr: &'a str, #[note(privacy_ty_note)] pub ty_span: Span, pub ty_kind: &'a str, - pub ty_descr: DiagnosticArgFromDisplay<'a>, + pub ty_descr: DiagArgFromDisplay<'a>, pub ty_vis_descr: &'a str, }