diff options
| author | Xiretza <xiretza@xiretza.xyz> | 2024-04-21 19:56:00 +0000 |
|---|---|---|
| committer | Xiretza <xiretza@xiretza.xyz> | 2024-05-21 20:11:42 +0000 |
| commit | 56bca95875ac710faebdaf35df4eff17e1e64c73 (patch) | |
| tree | e0d299f0d0e7a1a05438c7e0a97986e835be5968 | |
| parent | 3b979aebfe98099d2c2c6d320e364e9b7a50a8ac (diff) | |
| download | rust-56bca95875ac710faebdaf35df4eff17e1e64c73.tar.gz rust-56bca95875ac710faebdaf35df4eff17e1e64c73.zip | |
Implement IntoDiagArg for RustcVersion
| -rw-r--r-- | compiler/rustc_session/src/version.rs | 13 |
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())) + } +} |
