aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / vendor / quote / build.rs
| 1 | use std::env; |
| 2 | use std::process::Command; |
| 3 | use std::str; |
| 4 | |
| 5 | fn main() { |
| 6 | println!("cargo:rerun-if-changed=build.rs"); |
| 7 | |
| 8 | let Some(minor) = rustc_minor_version() else { |
| 9 | return; |
| 10 | }; |
| 11 | |
| 12 | if minor >= 77 { |
| 13 | println!("cargo:rustc-check-cfg=cfg(no_diagnostic_namespace)"); |
| 14 | } |
| 15 | |
| 16 | // Support for the `#[diagnostic]` tool attribute namespace |
| 17 | // https://blog.rust-lang.org/2024/05/02/Rust-1.78.0.html#diagnostic-attributes |
| 18 | if minor < 78 { |
| 19 | println!("cargo:rustc-cfg=no_diagnostic_namespace"); |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | fn rustc_minor_version() -> Option<u32> { |
| 24 | let rustc = env::var_os("RUSTC")?; |
| 25 | let output = Command::new(rustc).arg("--version").output().ok()?; |
| 26 | let version = str::from_utf8(&output.stdout).ok()?; |
| 27 | let mut pieces = version.split('.'); |
| 28 | if pieces.next() != Some("rustc 1") { |
| 29 | return None; |
| 30 | } |
| 31 | pieces.next()?.parse().ok() |
| 32 | } |