You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem
Users can define aliases in ~/.cargo/config.
But user-defined b, r, and t aliases do not work because they are shadowed by subcommand aliases (resp. for build, run, and test).
Cargo does not emit any warnings.
Steps
Add the following definition to ~/.cargo/config
[alias]
b = "foo"
Run cargo b
Cargo executes build subcommand, not foo, without any warnings
Notes
Current Cargo warns user-defined aliases shadowed by (non-alias) subcommands here:
Allow user aliases to override built-in aliases
This PR allows user-defined aliases take precedence over built-in ones, with a warning that tells there exists a built-in alias.
This PR does not allow user aliases override built-in subcommands.
```console
$ cat .cargo/config
[alias]
b = "fetch"
build = "fetch"
$ ./target/debug/cargo b
warning: user-defined alias `b` overrides a built-in alias for `build`
$ ./target/debug/cargo build
warning: user-defined alias `build` is ignored, because it is shadowed by a built-in command
Compiling proc-macro2 v0.4.19
Compiling unicode-xid v0.1.0
Compiling cc v1.0.25
(snip)
```
In the current version of Cargo, user aliases cannot override built-in aliases.
This behavior is keeping us from safely adding new built-in aliases without interfering existing user config.
Merging this PR will allow that.
Fixes#6221
Relating to #6218
Problem
Users can define aliases in
~/.cargo/config
.But user-defined
b
,r
, andt
aliases do not work because they are shadowed by subcommand aliases (resp. forbuild
,run
, andtest
).Cargo does not emit any warnings.
Steps
~/.cargo/config
cargo b
build
subcommand, notfoo
, without any warningsNotes
cargo/src/bin/cargo/cli.rs
Lines 121 to 126 in efb7972
c
alias forcheck
(Addc
alias forcheck
#6218), which will shadow user-definedc
aliases.Output of
cargo version
:cargo 1.29.0 (524a578d7 2018-08-05)
The text was updated successfully, but these errors were encountered: