-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Problem
Issue #10098 requested the addition of the -C <DIR>
flag. This flag was added in #10952, which closed #10098. However, using the -C
flag does not use the rust-toolchain.toml
file from the given directory.
For context, see this note from issue #10098:
Regarding rustup and
rust-toolchain.toml
overrides, I'm inclined to say rustup should honor this flag as well and interpret it prior to locating an override file. The idea here is that sayingcargo -C $path …
should behave indistinguishably from runningcargo
within that path.
Steps
- Run the following commands:
rustup default beta # since `-C` isn't released on stable yet
cargo new use-nightly
- Create
use-nightly/rust-toolchain.toml
with the following contents:
[toolchain]
channel = "nightly"
- Check the version of
cargo
being used with the-C
option vscd
command and note the difference:
$ (cd use-nightly && cargo --version)
cargo 1.70.0-nightly (0e474cfd7 2023-03-31)
$ cargo -C use-nightly --version
cargo 1.69.0-beta.6 (713164a40 2023-03-26)
- If you want to take this one step further, try using a nightly-only feature within the
use-nightly
directory. With-C
it will fail, but withcd use-nightly && cargo build
it should succeed.
Possible Solution(s)
No response
Notes
I'm not sure how practical it is to actually fix this issue, but wanted to call attention to it, especially since fixing this after it reaches the stable channel could break things for anyone who might depend on the current behavior.
If it is practical, and someone could point me toward the relevant code, I would be happy to work on fixing this myself.
Version
cargo 1.69.0-beta.6 (713164a40 2023-03-26)
release: 1.69.0-beta.6
commit-hash: 713164a40962a0a76c7f3ad8aafb6f03410e21d2
commit-date: 2023-03-26
host: x86_64-unknown-linux-gnu
libgit2: 1.5.0 (sys:0.16.0 vendored)
libcurl: 7.86.0-DEV (sys:0.4.59+curl-7.86.0 vendored ssl:OpenSSL/1.1.1q)
os: Pop!_OS 22.04 (jammy) [64-bit]