mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-01 04:27:38 +00:00
26 lines
658 B
Rust
26 lines
658 B
Rust
use std::fmt::{self, Display};
|
|
|
|
use rustc_macros::{
|
|
Decodable, Encodable, HashStable_Generic, PrintAttribute, current_rustc_version,
|
|
};
|
|
|
|
use crate::PrintAttribute;
|
|
|
|
#[derive(Encodable, Decodable, Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
|
#[derive(HashStable_Generic, PrintAttribute)]
|
|
pub struct RustcVersion {
|
|
pub major: u16,
|
|
pub minor: u16,
|
|
pub patch: u16,
|
|
}
|
|
|
|
impl RustcVersion {
|
|
pub const CURRENT: Self = current_rustc_version!();
|
|
}
|
|
|
|
impl Display for RustcVersion {
|
|
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
write!(formatter, "{}.{}.{}", self.major, self.minor, self.patch)
|
|
}
|
|
}
|