Files
pack/examples/rust-cargo-workspaces-glob/example/binary/build.rs
T
Michael BiancoandGitHub d7302e8ea6 test: assert against specific rust version defined by rust-toolchain.toml (#299)
* test: assert against specific rust version defined by rust-toolchain.toml

* test: assert cargo workspace version

* test: assert specific rust version in integration tests

* test: fix wrong rust version

need to add a .tool-version in another PR
2025-10-21 14:12:14 -06:00

22 lines
498 B
Rust

use std::process::Command;
fn main() {
let output = Command::new("rustc")
.arg("--version")
.output()
.expect("Failed to execute rustc");
let version = String::from_utf8(output.stdout)
.expect("Invalid UTF-8 in rustc output")
.trim()
.to_string();
let simplified_version = version
.split('(')
.next()
.unwrap_or(&version)
.trim();
println!("cargo:rustc-env=RUST_VERSION={}", simplified_version);
}