Overriding config through nested aliases does not work
Problem
Passing --config ... inside of a cargo alias, and using that with another cargo alias does not work.
Steps
-
cargo new test; cd test -
.cargo/config.toml
[alias]
my_alias = '--config build.rustflags=["--invalid"]'
-
cargo my_alias cpasses, butcargo my_alias checkfails, indicating that the--configis not propagated through thec = checkalias
Possible Solution(s)
No response
Notes
No response
Version
cargo 1.79.0-nightly (c93926759 2024-04-23)
release: 1.79.0-nightly
commit-hash: c9392675917adc2edab269eea27c222b5359c637
commit-date: 2024-04-23
host: x86_64-unknown-linux-gnu
libgit2: 1.7.2 (sys:0.18.3 vendored)
libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w 11 Sep 2023
os: Manjaro 23.1.4 (Vulcan) [64-bit]
@rustbot label +A-aliases
Currently, the context is loaded in two phases
-
GlobalContext::newat app start -
GlobalContext::configureonce the whole command-line has been parsed.
This would require us to add a third phase and correctly merge it in. The most likely to get wrong part is related to verbosity
This seems to be an unsupported behavior that is accidentally supported. From the [alias] doc:
The value may be an array of strings, where the first element is the command and the following are arguments. It may also be a string
We may need to figure out since when it started working, and consider either banning or officially supportting it.