Skip to content

Commit

Permalink
Make RUSTC_FORCE_RUSTC_VERSION overwrite the rendered version output,…
Browse files Browse the repository at this point in the history
… too
  • Loading branch information
oli-obk committed Apr 25, 2024
1 parent 2d45cdb commit b961660
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 @@ -878,6 +878,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_FORCE_RUSTC_VERSION") {
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 b961660

Please sign in to comment.