Implement IntoDiagArg for RustcVersion
This commit is contained in:
parent
3b979aebfe
commit
56bca95875
@ -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 @@ fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
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()))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user