Skip to content

Commit a09b1d3

Browse files
committed
Rename IntoDiagnosticArg as IntoDiagArg.
Also rename `into_diagnostic_arg` as `into_diag_arg`, and `NotIntoDiagnosticArg` as `NotInotDiagArg`.
1 parent 256d802 commit a09b1d3

File tree

38 files changed

+218
-219
lines changed

38 files changed

+218
-219
lines changed

compiler/rustc_borrowck/src/diagnostics/region_name.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ impl Display for RegionName {
191191
}
192192
}
193193

194-
impl rustc_errors::IntoDiagnosticArg for RegionName {
195-
fn into_diagnostic_arg(self) -> rustc_errors::DiagArgValue {
196-
self.to_string().into_diagnostic_arg()
194+
impl rustc_errors::IntoDiagArg for RegionName {
195+
fn into_diag_arg(self) -> rustc_errors::DiagArgValue {
196+
self.to_string().into_diag_arg()
197197
}
198198
}
199199

compiler/rustc_codegen_ssa/src/assert_module_sources.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::errors;
2727
use rustc_ast as ast;
2828
use rustc_data_structures::unord::UnordMap;
2929
use rustc_data_structures::unord::UnordSet;
30-
use rustc_errors::{DiagArgValue, IntoDiagnosticArg};
30+
use rustc_errors::{DiagArgValue, IntoDiagArg};
3131
use rustc_hir::def_id::LOCAL_CRATE;
3232
use rustc_middle::mir::mono::CodegenUnitNameBuilder;
3333
use rustc_middle::ty::TyCtxt;
@@ -205,8 +205,8 @@ impl fmt::Display for CguReuse {
205205
}
206206
}
207207

208-
impl IntoDiagnosticArg for CguReuse {
209-
fn into_diagnostic_arg(self) -> DiagArgValue {
208+
impl IntoDiagArg for CguReuse {
209+
fn into_diag_arg(self) -> DiagArgValue {
210210
DiagArgValue::Str(Cow::Owned(self.to_string()))
211211
}
212212
}

compiler/rustc_codegen_ssa/src/errors.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ use crate::assert_module_sources::CguReuse;
44
use crate::back::command::Command;
55
use crate::fluent_generated as fluent;
66
use rustc_errors::{
7-
codes::*, Diag, DiagArgValue, DiagCtxt, EmissionGuarantee, IntoDiagnostic, IntoDiagnosticArg,
8-
Level,
7+
codes::*, Diag, DiagArgValue, DiagCtxt, EmissionGuarantee, IntoDiagArg, IntoDiagnostic, Level,
98
};
109
use rustc_macros::Diagnostic;
1110
use rustc_middle::ty::layout::LayoutError;
@@ -152,8 +151,8 @@ impl<'a> CopyPath<'a> {
152151

153152
struct DebugArgPath<'a>(pub &'a Path);
154153

155-
impl IntoDiagnosticArg for DebugArgPath<'_> {
156-
fn into_diagnostic_arg(self) -> rustc_errors::DiagArgValue {
154+
impl IntoDiagArg for DebugArgPath<'_> {
155+
fn into_diag_arg(self) -> rustc_errors::DiagArgValue {
157156
DiagArgValue::Str(Cow::Owned(format!("{:?}", self.0)))
158157
}
159158
}
@@ -974,8 +973,8 @@ pub enum ExpectedPointerMutability {
974973
Not,
975974
}
976975

977-
impl IntoDiagnosticArg for ExpectedPointerMutability {
978-
fn into_diagnostic_arg(self) -> DiagArgValue {
976+
impl IntoDiagArg for ExpectedPointerMutability {
977+
fn into_diag_arg(self) -> DiagArgValue {
979978
match self {
980979
ExpectedPointerMutability::Mut => DiagArgValue::Str(Cow::Borrowed("*mut")),
981980
ExpectedPointerMutability::Not => DiagArgValue::Str(Cow::Borrowed("*_")),

compiler/rustc_const_eval/src/const_eval/error.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::mem;
22

3-
use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, IntoDiagnostic, IntoDiagnosticArg};
3+
use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, IntoDiagArg, IntoDiagnostic};
44
use rustc_hir::CRATE_HIR_ID;
55
use rustc_middle::mir::AssertKind;
66
use rustc_middle::query::TyCtxtAt;
@@ -40,10 +40,10 @@ impl MachineStopType for ConstEvalErrKind {
4040
RecursiveStatic | ConstAccessesMutGlobal | ModifiedGlobal => {}
4141
AssertFailure(kind) => kind.add_args(adder),
4242
Panic { msg, line, col, file } => {
43-
adder("msg".into(), msg.into_diagnostic_arg());
44-
adder("file".into(), file.into_diagnostic_arg());
45-
adder("line".into(), line.into_diagnostic_arg());
46-
adder("col".into(), col.into_diagnostic_arg());
43+
adder("msg".into(), msg.into_diag_arg());
44+
adder("file".into(), file.into_diag_arg());
45+
adder("line".into(), line.into_diag_arg());
46+
adder("col".into(), col.into_diag_arg());
4747
}
4848
}
4949
}

compiler/rustc_const_eval/src/errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -887,8 +887,8 @@ impl ReportErrorExt for ResourceExhaustionInfo {
887887
fn add_args<G: EmissionGuarantee>(self, _: &mut Diag<'_, G>) {}
888888
}
889889

890-
impl rustc_errors::IntoDiagnosticArg for InternKind {
891-
fn into_diagnostic_arg(self) -> DiagArgValue {
890+
impl rustc_errors::IntoDiagArg for InternKind {
891+
fn into_diag_arg(self) -> DiagArgValue {
892892
DiagArgValue::Str(Cow::Borrowed(match self {
893893
InternKind::Static(Mutability::Not) => "static",
894894
InternKind::Static(Mutability::Mut) => "static_mut",

compiler/rustc_errors/src/diagnostic.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub enum DiagArgValue {
3838
Str(Cow<'static, str>),
3939
// This gets converted to a `FluentNumber`, which is an `f64`. An `i32`
4040
// safely fits in an `f64`. Any integers bigger than that will be converted
41-
// to strings in `into_diagnostic_arg` and stored using the `Str` variant.
41+
// to strings in `into_diag_arg` and stored using the `Str` variant.
4242
Number(i32),
4343
StrListSepByAnd(Vec<Cow<'static, str>>),
4444
}
@@ -148,12 +148,12 @@ where
148148
/// Implemented as a custom trait rather than `From` so that it is implemented on the type being
149149
/// converted rather than on `DiagArgValue`, which enables types from other `rustc_*` crates to
150150
/// implement this.
151-
pub trait IntoDiagnosticArg {
152-
fn into_diagnostic_arg(self) -> DiagArgValue;
151+
pub trait IntoDiagArg {
152+
fn into_diag_arg(self) -> DiagArgValue;
153153
}
154154

155-
impl IntoDiagnosticArg for DiagArgValue {
156-
fn into_diagnostic_arg(self) -> DiagArgValue {
155+
impl IntoDiagArg for DiagArgValue {
156+
fn into_diag_arg(self) -> DiagArgValue {
157157
self
158158
}
159159
}
@@ -419,8 +419,8 @@ impl DiagInner {
419419
self.children.push(sub);
420420
}
421421

422-
pub(crate) fn arg(&mut self, name: impl Into<DiagArgName>, arg: impl IntoDiagnosticArg) {
423-
self.args.insert(name.into(), arg.into_diagnostic_arg());
422+
pub(crate) fn arg(&mut self, name: impl Into<DiagArgName>, arg: impl IntoDiagArg) {
423+
self.args.insert(name.into(), arg.into_diag_arg());
424424
}
425425

426426
/// Fields used for Hash, and PartialEq trait.
@@ -1243,7 +1243,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
12431243
pub fn arg(
12441244
&mut self,
12451245
name: impl Into<DiagArgName>,
1246-
arg: impl IntoDiagnosticArg,
1246+
arg: impl IntoDiagArg,
12471247
) -> &mut Self {
12481248
self.deref_mut().arg(name, arg);
12491249
self

0 commit comments

Comments
 (0)