1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//! Simple API for detecting the rust version.
#![no_std]
#![deny(missing_docs)]

#[macro_use]
mod macros;
pub mod date;
pub mod version;

pub use crate::date::Date;
pub use crate::version::{Channel, RustVersion, StableVersionSpec};

/// The detected rust compiler version.
pub const RUST_VERSION: RustVersion = self::detected::DETECTED_VERSION;

/// Version detected by build script.
#[allow(unused_imports)]
mod detected {
    use crate::date::Date;
    use crate::version::Channel::*;
    use crate::version::RustVersion as Version;

    #[cfg(not(host_os = "windows"))]
    pub const DETECTED_VERSION: Version = include!(concat!(env!("OUT_DIR"), "/version.expr"));

    #[cfg(host_os = "windows")]
    pub const DETECTED_VERSION: Version = include!(concat!(env!("OUT_DIR"), "\\version.expr"));
}