Skip to content

Commit 444af48

Browse files
committed
Don't warn about shadowing in the case where the alias is built-in
1 parent 3513780 commit 444af48

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/bin/cargo/cli.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,19 +262,21 @@ To pass the arguments to the subcommand, remove `--`",
262262
}
263263
(None, Ok(None)) => {}
264264
(None, Ok(Some(alias))) => {
265-
// Check if this alias is shadowing an external subcommand
265+
// Check if a user-defined alias is shadowing an external subcommand
266266
// (binary of the form `cargo-<subcommand>`)
267267
// Currently this is only a warning, but after a transition period this will become
268268
// a hard error.
269-
if let Some(path) = super::find_external_subcommand(config, cmd) {
270-
config.shell().warn(format!(
269+
if super::builtin_aliases_execs(cmd).is_none() {
270+
if let Some(path) = super::find_external_subcommand(config, cmd) {
271+
config.shell().warn(format!(
271272
"\
272273
user-defined alias `{}` is shadowing an external subcommand found at: `{}`
273274
This was previously accepted but is being phased out; it will become a hard error in a future release.
274275
For more information, see issue #10049 <https://github.com/rust-lang/cargo/issues/10049>.",
275276
cmd,
276277
path.display(),
277278
))?;
279+
}
278280
}
279281

280282
let mut alias = alias

0 commit comments

Comments
 (0)