-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cargo will always invoke the 'true' rustc on Windows, rather than a rustc shim #5960
Comments
Thanks for the report! I suspect that at least on windows we could avoid adding the sysroot to In that sense we can probably avoid doing this for all |
I'm going to close, since as of #11917 we are intentionally circumventing the rustup proxies. Also, since this was filed, things like telemetry have been removed from rustup. There's also been some changes to the priority of how things are added to PATH. There's still some work left to do (like rust-lang/rustup#3036), but those are tracked elsewhere. |
(by a 'rustc shim' I'm referring to things like rustup - it puts a shim rustc on the path which invokes the true rustc)
As part of invoking rustc for compilations, cargo will put a number of paths in the 'library environment', performed here (called from
Compilation::rustc_process
, which is called fromprepare_rustc
): https://github.com/rust-lang/cargo/blob/d4ee795/src/cargo/core/compiler/compilation.rs#L188-L204However, a few things conspire against us:
util::dylib_path_envvar()
) is the same as the binary search path (i.e.PATH
)rustc.exe
lives alongside dylibs likerustc_typeck-4d5d5a72bda8f430.dll
)This means that when actually performing the compilation, an attempted invocation of
rustc
will jump straight to the sysroot binaries rather than using the shim - anything that the shim does (like telemetry, in the case of the rustup) gets completely skipped for any compilations. You can observe this with a build plan on Windows:Note the
C:\\Users\\aidanhs\\.rustup\\toolchains\\nightly-2018-08-19-x86_64-pc-windows-msvc\\bin
with a higher priority thanC:\\Users\\aidanhs\\.cargo\\bin
in thePATH
.There is an additional oddity though - when performing configuration tests at cargo startup (
cargo/src/cargo/core/compiler/build_context/target_info.rs
Lines 68 to 75 in d4ee795
Quick thoughts:
The text was updated successfully, but these errors were encountered: