Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 03c1975

Browse files
committedDec 9, 2023
workaround cargo bugs on windows
1 parent 118b6e4 commit 03c1975

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed
 

‎src/bootstrap/src/bin/rustc.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//! never get replaced.
1717
1818
use std::env;
19-
use std::path::PathBuf;
19+
use std::path::{Path, PathBuf};
2020
use std::process::{Child, Command};
2121
use std::time::Instant;
2222

@@ -85,7 +85,10 @@ fn main() {
8585
} else {
8686
// Cargo doesn't respect RUSTC_WRAPPER for version information >:(
8787
// don't remove the first arg if we're being run as RUSTC instead of RUSTC_WRAPPER.
88-
if args[0] == env::current_exe().expect("couldn't get path to rustc shim") {
88+
// Cargo also sometimes doesn't pass the `.exe` suffix on Windows - add it manually.
89+
let current_exe = env::current_exe().expect("couldn't get path to rustc shim");
90+
let arg0 = exe(args[0].to_str().expect("only utf8 paths are supported"), &target_name);
91+
if Path::new(&arg0) == current_exe {
8992
args.remove(0);
9093
}
9194
rustc_real

0 commit comments

Comments
 (0)
Please sign in to comment.