From cba8503e3ad310abd680b4987be1b99154c90e3d Mon Sep 17 00:00:00 2001 From: Basile Henry Date: Wed, 17 Nov 2021 09:22:08 +0100 Subject: [PATCH] Add details in warning for alias shadowing external subcommands --- src/bin/cargo/cli.rs | 5 ++++- tests/testsuite/cargo_alias_config.rs | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/bin/cargo/cli.rs b/src/bin/cargo/cli.rs index 735f0aa8a..26d51984d 100644 --- a/src/bin/cargo/cli.rs +++ b/src/bin/cargo/cli.rs @@ -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 .", cmd, path.display(), ))?; diff --git a/tests/testsuite/cargo_alias_config.rs b/tests/testsuite/cargo_alias_config.rs index 6194f96d6..6d6a82b31 100644 --- a/tests/testsuite/cargo_alias_config.rs +++ b/tests/testsuite/cargo_alias_config.rs @@ -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 . 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 . error: alias test-1 has unresolvable recursive definition: test-1 -> echo -> echo ", )