Make RUSTC_OVERRIDE_VERSION_STRING overwrite the rendered version output, too

This commit is contained in:
Oli Scherer 2024-04-25 15:29:51 +00:00
parent cbab16feaf
commit 92f263b792
2 changed files with 10 additions and 1 deletions

View File

@ -909,6 +909,15 @@ pub fn version_at_macro_invocation(
) {
let verbose = matches.opt_present("verbose");
let mut version = version;
let mut release = release;
let tmp;
if let Ok(force_version) = std::env::var("RUSTC_OVERRIDE_VERSION_STRING") {
tmp = force_version;
version = &tmp;
release = &tmp;
}
safe_println!("{binary} {version}");
if verbose {

View File

@ -13,5 +13,5 @@ fn main() {
.unwrap()
.stdout;
let version = std::str::from_utf8(&version).unwrap().strip_prefix("rustc ").unwrap().trim_end();
assert_ne!(version, signalled_version);
assert_eq!(version, signalled_version);
}