mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00

It turns out, running `cargo rustc --print cfg -Zunstable-options` (and the like, https://github.com/rust-lang/cargo/issues/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)