Skip to content

Commit f0c27cc

Browse files
committed
Implement IntoDiagArg for RustcVersion
1 parent 934078d commit f0c27cc

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

compiler/rustc_session/src/version.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
use std::fmt::{self, Display};
1+
use std::{
2+
borrow::Cow,
3+
fmt::{self, Display},
4+
};
5+
6+
use rustc_errors::IntoDiagArg;
27

38
#[derive(Encodable, Decodable, Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
49
#[derive(HashStable_Generic)]
@@ -17,3 +22,9 @@ impl Display for RustcVersion {
1722
write!(formatter, "{}.{}.{}", self.major, self.minor, self.patch)
1823
}
1924
}
25+
26+
impl IntoDiagArg for RustcVersion {
27+
fn into_diag_arg(self) -> rustc_errors::DiagArgValue {
28+
rustc_errors::DiagArgValue::Str(Cow::Owned(self.to_string()))
29+
}
30+
}

0 commit comments

Comments
 (0)