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 26, 2024
1 parent 984039f commit 192671f
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 @@ -908,6 +908,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 @@ -10,5 +10,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 192671f

Please sign in to comment.