about summary refs log tree commit diff
path: root/compiler/rustc_errors/src/diagnostic_impls.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-02-23 14:37:48 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2024-02-28 08:55:37 +1100
commit8199632aa88c15f8e8cba942b9e6c38826b141dd (patch)
tree22d53c30c2a8db6d5eb40c5bed03da6e2f4ed172 /compiler/rustc_errors/src/diagnostic_impls.rs
parent899cb40809a85eb9d89f6da3268713b83175360a (diff)
downloadrust-8199632aa88c15f8e8cba942b9e6c38826b141dd.tar.gz
rust-8199632aa88c15f8e8cba942b9e6c38826b141dd.zip
Rename `DiagnosticArg{,Map,Name,Value}` as `DiagArg{,Map,Name,Value}`.
Diffstat (limited to 'compiler/rustc_errors/src/diagnostic_impls.rs')
-rw-r--r--compiler/rustc_errors/src/diagnostic_impls.rs116
1 files changed, 58 insertions, 58 deletions
diff --git a/compiler/rustc_errors/src/diagnostic_impls.rs b/compiler/rustc_errors/src/diagnostic_impls.rs
index 3db0abb48c2..ec43a0e54e4 100644
--- a/compiler/rustc_errors/src/diagnostic_impls.rs
+++ b/compiler/rustc_errors/src/diagnostic_impls.rs
@@ -1,8 +1,8 @@
 use crate::diagnostic::DiagnosticLocation;
 use crate::{fluent_generated as fluent, AddToDiagnostic};
 use crate::{
-    Diag, DiagCtxt, DiagnosticArgValue, EmissionGuarantee, ErrCode, IntoDiagnostic,
-    IntoDiagnosticArg, Level, SubdiagnosticMessageOp,
+    Diag, DiagArgValue, DiagCtxt, EmissionGuarantee, ErrCode, IntoDiagnostic, IntoDiagnosticArg,
+    Level, SubdiagnosticMessageOp,
 };
 use rustc_ast as ast;
 use rustc_ast_pretty::pprust;
@@ -23,7 +23,7 @@ use std::process::ExitStatus;
 pub struct DiagnosticArgFromDisplay<'a>(pub &'a dyn fmt::Display);
 
 impl IntoDiagnosticArg for DiagnosticArgFromDisplay<'_> {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
+    fn into_diagnostic_arg(self) -> DiagArgValue {
         self.0.to_string().into_diagnostic_arg()
     }
 }
@@ -41,7 +41,7 @@ impl<'a, T: fmt::Display> From<&'a T> for DiagnosticArgFromDisplay<'a> {
 }
 
 impl<'a, T: Clone + IntoDiagnosticArg> IntoDiagnosticArg for &'a T {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
+    fn into_diagnostic_arg(self) -> DiagArgValue {
         self.clone().into_diagnostic_arg()
     }
 }
@@ -50,7 +50,7 @@ macro_rules! into_diagnostic_arg_using_display {
     ($( $ty:ty ),+ $(,)?) => {
         $(
             impl IntoDiagnosticArg for $ty {
-                fn into_diagnostic_arg(self) -> DiagnosticArgValue {
+                fn into_diagnostic_arg(self) -> DiagArgValue {
                     self.to_string().into_diagnostic_arg()
                 }
             }
@@ -62,10 +62,10 @@ macro_rules! into_diagnostic_arg_for_number {
     ($( $ty:ty ),+ $(,)?) => {
         $(
             impl IntoDiagnosticArg for $ty {
-                fn into_diagnostic_arg(self) -> DiagnosticArgValue {
+                fn into_diagnostic_arg(self) -> DiagArgValue {
                     // Convert to a string if it won't fit into `Number`.
                     if let Ok(n) = TryInto::<i32>::try_into(self) {
-                        DiagnosticArgValue::Number(n)
+                        DiagArgValue::Number(n)
                     } else {
                         self.to_string().into_diagnostic_arg()
                     }
@@ -95,74 +95,74 @@ into_diagnostic_arg_using_display!(
 into_diagnostic_arg_for_number!(i8, u8, i16, u16, i32, u32, i64, u64, i128, u128, isize, usize);
 
 impl IntoDiagnosticArg for bool {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
+    fn into_diagnostic_arg(self) -> DiagArgValue {
         if self {
-            DiagnosticArgValue::Str(Cow::Borrowed("true"))
+            DiagArgValue::Str(Cow::Borrowed("true"))
         } else {
-            DiagnosticArgValue::Str(Cow::Borrowed("false"))
+            DiagArgValue::Str(Cow::Borrowed("false"))
         }
     }
 }
 
 impl IntoDiagnosticArg for char {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
-        DiagnosticArgValue::Str(Cow::Owned(format!("{self:?}")))
+    fn into_diagnostic_arg(self) -> DiagArgValue {
+        DiagArgValue::Str(Cow::Owned(format!("{self:?}")))
     }
 }
 
 impl IntoDiagnosticArg for Vec<char> {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
-        DiagnosticArgValue::StrListSepByAnd(
+    fn into_diagnostic_arg(self) -> DiagArgValue {
+        DiagArgValue::StrListSepByAnd(
             self.into_iter().map(|c| Cow::Owned(format!("{c:?}"))).collect(),
         )
     }
 }
 
 impl IntoDiagnosticArg for Symbol {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
+    fn into_diagnostic_arg(self) -> DiagArgValue {
         self.to_ident_string().into_diagnostic_arg()
     }
 }
 
 impl<'a> IntoDiagnosticArg for &'a str {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
+    fn into_diagnostic_arg(self) -> DiagArgValue {
         self.to_string().into_diagnostic_arg()
     }
 }
 
 impl IntoDiagnosticArg for String {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
-        DiagnosticArgValue::Str(Cow::Owned(self))
+    fn into_diagnostic_arg(self) -> DiagArgValue {
+        DiagArgValue::Str(Cow::Owned(self))
     }
 }
 
 impl<'a> IntoDiagnosticArg for Cow<'a, str> {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
-        DiagnosticArgValue::Str(Cow::Owned(self.into_owned()))
+    fn into_diagnostic_arg(self) -> DiagArgValue {
+        DiagArgValue::Str(Cow::Owned(self.into_owned()))
     }
 }
 
 impl<'a> IntoDiagnosticArg for &'a Path {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
-        DiagnosticArgValue::Str(Cow::Owned(self.display().to_string()))
+    fn into_diagnostic_arg(self) -> DiagArgValue {
+        DiagArgValue::Str(Cow::Owned(self.display().to_string()))
     }
 }
 
 impl IntoDiagnosticArg for PathBuf {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
-        DiagnosticArgValue::Str(Cow::Owned(self.display().to_string()))
+    fn into_diagnostic_arg(self) -> DiagArgValue {
+        DiagArgValue::Str(Cow::Owned(self.display().to_string()))
     }
 }
 
 impl IntoDiagnosticArg for PanicStrategy {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
-        DiagnosticArgValue::Str(Cow::Owned(self.desc().to_string()))
+    fn into_diagnostic_arg(self) -> DiagArgValue {
+        DiagArgValue::Str(Cow::Owned(self.desc().to_string()))
     }
 }
 
 impl IntoDiagnosticArg for hir::ConstContext {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
-        DiagnosticArgValue::Str(Cow::Borrowed(match self {
+    fn into_diagnostic_arg(self) -> DiagArgValue {
+        DiagArgValue::Str(Cow::Borrowed(match self {
             hir::ConstContext::ConstFn => "const_fn",
             hir::ConstContext::Static(_) => "static",
             hir::ConstContext::Const { .. } => "const",
@@ -171,58 +171,58 @@ impl IntoDiagnosticArg for hir::ConstContext {
 }
 
 impl IntoDiagnosticArg for ast::Expr {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
-        DiagnosticArgValue::Str(Cow::Owned(pprust::expr_to_string(&self)))
+    fn into_diagnostic_arg(self) -> DiagArgValue {
+        DiagArgValue::Str(Cow::Owned(pprust::expr_to_string(&self)))
     }
 }
 
 impl IntoDiagnosticArg for ast::Path {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
-        DiagnosticArgValue::Str(Cow::Owned(pprust::path_to_string(&self)))
+    fn into_diagnostic_arg(self) -> DiagArgValue {
+        DiagArgValue::Str(Cow::Owned(pprust::path_to_string(&self)))
     }
 }
 
 impl IntoDiagnosticArg for ast::token::Token {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
-        DiagnosticArgValue::Str(pprust::token_to_string(&self))
+    fn into_diagnostic_arg(self) -> DiagArgValue {
+        DiagArgValue::Str(pprust::token_to_string(&self))
     }
 }
 
 impl IntoDiagnosticArg for ast::token::TokenKind {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
-        DiagnosticArgValue::Str(pprust::token_kind_to_string(&self))
+    fn into_diagnostic_arg(self) -> DiagArgValue {
+        DiagArgValue::Str(pprust::token_kind_to_string(&self))
     }
 }
 
 impl IntoDiagnosticArg for type_ir::FloatTy {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
-        DiagnosticArgValue::Str(Cow::Borrowed(self.name_str()))
+    fn into_diagnostic_arg(self) -> DiagArgValue {
+        DiagArgValue::Str(Cow::Borrowed(self.name_str()))
     }
 }
 
 impl IntoDiagnosticArg for std::ffi::CString {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
-        DiagnosticArgValue::Str(Cow::Owned(self.to_string_lossy().into_owned()))
+    fn into_diagnostic_arg(self) -> DiagArgValue {
+        DiagArgValue::Str(Cow::Owned(self.to_string_lossy().into_owned()))
     }
 }
 
 impl IntoDiagnosticArg for rustc_data_structures::small_c_str::SmallCStr {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
-        DiagnosticArgValue::Str(Cow::Owned(self.to_string_lossy().into_owned()))
+    fn into_diagnostic_arg(self) -> DiagArgValue {
+        DiagArgValue::Str(Cow::Owned(self.to_string_lossy().into_owned()))
     }
 }
 
 impl IntoDiagnosticArg for ast::Visibility {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
+    fn into_diagnostic_arg(self) -> DiagArgValue {
         let s = pprust::vis_to_string(&self);
         let s = s.trim_end().to_string();
-        DiagnosticArgValue::Str(Cow::Owned(s))
+        DiagArgValue::Str(Cow::Owned(s))
     }
 }
 
 impl IntoDiagnosticArg for rustc_lint_defs::Level {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
-        DiagnosticArgValue::Str(Cow::Borrowed(self.to_cmd_flag()))
+    fn into_diagnostic_arg(self) -> DiagArgValue {
+        DiagArgValue::Str(Cow::Borrowed(self.to_cmd_flag()))
     }
 }
 
@@ -236,16 +236,16 @@ impl From<Vec<Symbol>> for DiagnosticSymbolList {
 }
 
 impl IntoDiagnosticArg for DiagnosticSymbolList {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
-        DiagnosticArgValue::StrListSepByAnd(
+    fn into_diagnostic_arg(self) -> DiagArgValue {
+        DiagArgValue::StrListSepByAnd(
             self.0.into_iter().map(|sym| Cow::Owned(format!("`{sym}`"))).collect(),
         )
     }
 }
 
 impl<Id> IntoDiagnosticArg for hir::def::Res<Id> {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
-        DiagnosticArgValue::Str(Cow::Borrowed(self.descr()))
+    fn into_diagnostic_arg(self) -> DiagArgValue {
+        DiagArgValue::Str(Cow::Borrowed(self.descr()))
     }
 }
 
@@ -316,20 +316,20 @@ pub struct ExpectedLifetimeParameter {
 }
 
 impl IntoDiagnosticArg for DiagnosticLocation {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
-        DiagnosticArgValue::Str(Cow::from(self.to_string()))
+    fn into_diagnostic_arg(self) -> DiagArgValue {
+        DiagArgValue::Str(Cow::from(self.to_string()))
     }
 }
 
 impl IntoDiagnosticArg for Backtrace {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
-        DiagnosticArgValue::Str(Cow::from(self.to_string()))
+    fn into_diagnostic_arg(self) -> DiagArgValue {
+        DiagArgValue::Str(Cow::from(self.to_string()))
     }
 }
 
 impl IntoDiagnosticArg for Level {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
-        DiagnosticArgValue::Str(Cow::from(self.to_string()))
+    fn into_diagnostic_arg(self) -> DiagArgValue {
+        DiagArgValue::Str(Cow::from(self.to_string()))
     }
 }
 
@@ -343,7 +343,7 @@ pub struct IndicateAnonymousLifetime {
 }
 
 impl IntoDiagnosticArg for type_ir::ClosureKind {
-    fn into_diagnostic_arg(self) -> DiagnosticArgValue {
-        DiagnosticArgValue::Str(self.as_str().into())
+    fn into_diagnostic_arg(self) -> DiagArgValue {
+        DiagArgValue::Str(self.as_str().into())
     }
 }