File tree 2 files changed +11
-2
lines changed
2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 16
16
//! never get replaced.
17
17
18
18
use std:: env;
19
- use std:: path:: PathBuf ;
19
+ use std:: path:: { Path , PathBuf } ;
20
20
use std:: process:: { Child , Command } ;
21
21
use std:: time:: Instant ;
22
22
@@ -83,7 +83,12 @@ fn main() {
83
83
} else {
84
84
// Cargo doesn't respect RUSTC_WRAPPER for version information >:(
85
85
// don't remove the first arg if we're being run as RUSTC instead of RUSTC_WRAPPER.
86
- if args[ 0 ] == env:: current_exe ( ) . expect ( "couldn't get path to rustc shim" ) {
86
+ // Cargo also sometimes doesn't pass the `.exe` suffix on Windows - add it manually.
87
+ let current_exe = env:: current_exe ( ) . expect ( "couldn't get path to rustc shim" ) ;
88
+ // NOTE: we intentionally pass the name of the host, not the target.
89
+ let host = env:: var ( "CFG_COMPILER_BUILD_TRIPLE" ) . unwrap ( ) ;
90
+ let arg0 = exe ( args[ 0 ] . to_str ( ) . expect ( "only utf8 paths are supported" ) , & host) ;
91
+ if Path :: new ( & arg0) == current_exe {
87
92
args. remove ( 0 ) ;
88
93
}
89
94
rustc_real
Original file line number Diff line number Diff line change @@ -2022,7 +2022,11 @@ impl<'a> Builder<'a> {
2022
2022
// Environment variables *required* throughout the build
2023
2023
//
2024
2024
// FIXME: should update code to not require this env var
2025
+
2026
+ // The host this new compiler will *run* on.
2025
2027
cargo. env ( "CFG_COMPILER_HOST_TRIPLE" , target. triple ) ;
2028
+ // The host this new compiler is being *built* on.
2029
+ cargo. env ( "CFG_COMPILER_BUILD_TRIPLE" , compiler. host . triple ) ;
2026
2030
2027
2031
// Set this for all builds to make sure doc builds also get it.
2028
2032
cargo. env ( "CFG_RELEASE_CHANNEL" , & self . config . channel ) ;
You can’t perform that action at this time.
0 commit comments