Add details in warning for alias shadowing external subcommands

This commit is contained in:
Basile Henry 2021-11-17 09:22:08 +01:00
parent 3a5bb75467
commit cba8503e3a
2 changed files with 10 additions and 3 deletions

View file

@ -267,7 +267,10 @@ fn expand_aliases(
// a hard error.
if let Some(path) = super::find_external_subcommand(config, cmd) {
config.shell().warn(format!(
"user-defined alias `{}` is shadowing an external subcommand found at: `{}`",
"\
user-defined alias `{}` is shadowing an external subcommand found at: `{}`
This was previously accepted but is being phased out; it will become a hard error in a future release.
For more information, see issue #10049 <https://github.com/rust-lang/cargo/issues/10049>.",
cmd,
path.display(),
))?;

View file

@ -101,7 +101,9 @@ fn default_args_alias() {
.env("PATH", &path)
.with_status(101)
.with_stderr("\
warning: user-defined alias `echo` is shadowing an external subcommand found at: `[ROOT]/cargo-echo/target/debug/cargo-echo[EXE]`
[WARNING] user-defined alias `echo` is shadowing an external subcommand found at: `[ROOT]/cargo-echo/target/debug/cargo-echo[EXE]`
This was previously accepted but is being phased out; it will become a hard error in a future release.
For more information, see issue #10049 <https://github.com/rust-lang/cargo/issues/10049>.
error: alias echo has unresolvable recursive definition: echo -> echo
",
)
@ -111,7 +113,9 @@ error: alias echo has unresolvable recursive definition: echo -> echo
.env("PATH", &path)
.with_status(101)
.with_stderr("\
warning: user-defined alias `echo` is shadowing an external subcommand found at: `[ROOT]/cargo-echo/target/debug/cargo-echo[EXE]`
[WARNING] user-defined alias `echo` is shadowing an external subcommand found at: `[ROOT]/cargo-echo/target/debug/cargo-echo[EXE]`
This was previously accepted but is being phased out; it will become a hard error in a future release.
For more information, see issue #10049 <https://github.com/rust-lang/cargo/issues/10049>.
error: alias test-1 has unresolvable recursive definition: test-1 -> echo -> echo
",
)