built-in alias is shadowing external subcommand but Cargo warns "user-defined alias is shadowing" #11149
Labels
A-aliases
Area: command aliases
A-custom-subcommands
Area: custom 3rd party subcommand plugins
A-diagnostics
Area: Error and warning messages generated by Cargo itself.
C-bug
Category: bug
Problem
During the integration of
cargo-rm
, we found that if a user already gotcargo-edit
installed, they will get an errorwhich is confusing since
rm
is actually not a user-defined alias but a built-in one.Steps
Create an external subcommand conflicting with the name of a built-in alias
touch $HOME/.cargo/bin/cargo-t
chmod +x $HOME/.cargo/bin/cargo-t
cargo t
and you will see the warning.Possible Solution(s)
A simple fix I can see is differentiating the warning based on where the alias comes.
Notes
Not directly related but we will in peril when the warning becomes a hard error. The built-in alias such as
cargo rm
won't work anymore if user gotcargo-edit
installed. This is really a thorny problem because Cargo favors user-defined aliases over built-in (see here). Giving built-in aliases higher priority might fix the issue, though it might break others aliases as well.Version
The text was updated successfully, but these errors were encountered: