Skip to content

Commit

Permalink
Make RUSTC_OVERRIDE_VERSION_STRING overwrite the rendered version out…
Browse files Browse the repository at this point in the history
…put, too
  • Loading branch information
oli-obk committed Jul 30, 2024
1 parent cbab16f commit 92f263b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/feature-gates/version_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 92f263b

Please sign in to comment.