about summary refs log tree commit diff
diff options
context:
space:
mode:
authorXiretza <xiretza@xiretza.xyz>2024-04-21 19:56:00 +0000
committerXiretza <xiretza@xiretza.xyz>2024-05-21 20:11:42 +0000
commit56bca95875ac710faebdaf35df4eff17e1e64c73 (patch)
treee0d299f0d0e7a1a05438c7e0a97986e835be5968
parent3b979aebfe98099d2c2c6d320e364e9b7a50a8ac (diff)
downloadrust-56bca95875ac710faebdaf35df4eff17e1e64c73.tar.gz
rust-56bca95875ac710faebdaf35df4eff17e1e64c73.zip
Implement IntoDiagArg for RustcVersion
-rw-r--r--compiler/rustc_session/src/version.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/rustc_session/src/version.rs b/compiler/rustc_session/src/version.rs
index 39e4541349e..e244c77f7f9 100644
--- a/compiler/rustc_session/src/version.rs
+++ b/compiler/rustc_session/src/version.rs
@@ -1,5 +1,10 @@
 use rustc_macros::{current_rustc_version, Decodable, Encodable, HashStable_Generic};
-use std::fmt::{self, Display};
+use std::{
+    borrow::Cow,
+    fmt::{self, Display},
+};
+
+use rustc_errors::IntoDiagArg;
 
 #[derive(Encodable, Decodable, Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
 #[derive(HashStable_Generic)]
@@ -18,3 +23,9 @@ impl Display for RustcVersion {
         write!(formatter, "{}.{}.{}", self.major, self.minor, self.patch)
     }
 }
+
+impl IntoDiagArg for RustcVersion {
+    fn into_diag_arg(self) -> rustc_errors::DiagArgValue {
+        rustc_errors::DiagArgValue::Str(Cow::Owned(self.to_string()))
+    }
+}