fn main() { let output = std::process::Command::new("rustc") .arg("--version") .output() .expect("Failed to run rustc --version"); let full = String::from_utf8(output.stdout).unwrap(); // "rustc 1.79.0 (129f3b996 2024-06-10)" → "1.79.0" let version = full .trim() .trim_start_matches("rustc ") .split_whitespace() .next() .unwrap_or("unknown") .to_string(); println!("cargo:rustc-env=RUSTC_VERSION={}", version); // Expose the build target triple so selfupdate can match release assets. println!( "cargo:rustc-env=BUILD_TARGET={}", std::env::var("TARGET").unwrap_or_default() ); println!("cargo:rerun-if-changed=build.rs"); }