Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup cargo environment for
cargo rustc --print
(#15026)
It turns out, running `cargo rustc --print cfg -Zunstable-options` (and the like, #9357) fail with `.cargo/config.toml` setups like ```toml [build] # custom target json that lives in `./targets/my-super-cool-target.json` target = "my-super-cool-target" [env] RUST_TARGET_PATH = { value = "./targets", relative = true } ``` resulting in ``` ❯ cargo rustc --print cfg -Zunstable-options error: Error loading target specification: Could not find specification for target "my-super-cool-target". Run `rustc --print target-list` for a list of built-in targets error: process didn't exit successfully: `C:\Users\lukas\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\bin\rustc.exe --target my-super-cool-target --print cfg` (exit code: 1) ``` The reason for that is that cargo recognizes the target from the `.cargo/config` and then implicitly passes that along to the spawned rustc process, but it does so without passing along the important environment that is required for the target tuple to make sense. (can add a test if desired, just tell me where)
- Loading branch information