Skip to content

Commit cba8503

Browse files
committed
Add details in warning for alias shadowing external subcommands
1 parent 3a5bb75 commit cba8503

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/bin/cargo/cli.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,10 @@ fn expand_aliases(
267267
// a hard error.
268268
if let Some(path) = super::find_external_subcommand(config, cmd) {
269269
config.shell().warn(format!(
270-
"user-defined alias `{}` is shadowing an external subcommand found at: `{}`",
270+
"\
271+
user-defined alias `{}` is shadowing an external subcommand found at: `{}`
272+
This was previously accepted but is being phased out; it will become a hard error in a future release.
273+
For more information, see issue #10049 <https://github.com/rust-lang/cargo/issues/10049>.",
271274
cmd,
272275
path.display(),
273276
))?;

tests/testsuite/cargo_alias_config.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ fn default_args_alias() {
101101
.env("PATH", &path)
102102
.with_status(101)
103103
.with_stderr("\
104-
warning: user-defined alias `echo` is shadowing an external subcommand found at: `[ROOT]/cargo-echo/target/debug/cargo-echo[EXE]`
104+
[WARNING] user-defined alias `echo` is shadowing an external subcommand found at: `[ROOT]/cargo-echo/target/debug/cargo-echo[EXE]`
105+
This was previously accepted but is being phased out; it will become a hard error in a future release.
106+
For more information, see issue #10049 <https://github.com/rust-lang/cargo/issues/10049>.
105107
error: alias echo has unresolvable recursive definition: echo -> echo
106108
",
107109
)
@@ -111,7 +113,9 @@ error: alias echo has unresolvable recursive definition: echo -> echo
111113
.env("PATH", &path)
112114
.with_status(101)
113115
.with_stderr("\
114-
warning: user-defined alias `echo` is shadowing an external subcommand found at: `[ROOT]/cargo-echo/target/debug/cargo-echo[EXE]`
116+
[WARNING] user-defined alias `echo` is shadowing an external subcommand found at: `[ROOT]/cargo-echo/target/debug/cargo-echo[EXE]`
117+
This was previously accepted but is being phased out; it will become a hard error in a future release.
118+
For more information, see issue #10049 <https://github.com/rust-lang/cargo/issues/10049>.
115119
error: alias test-1 has unresolvable recursive definition: test-1 -> echo -> echo
116120
",
117121
)

0 commit comments

Comments
 (0)