File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,38 @@ fn dependent_alias() {
7676 . run ( ) ;
7777}
7878
79+ #[ cargo_test]
80+ fn alias_shadowing_external_subcommand ( ) {
81+ let echo = echo_subcommand ( ) ;
82+ let p = project ( )
83+ . file ( "Cargo.toml" , & basic_bin_manifest ( "foo" ) )
84+ . file ( "src/main.rs" , "fn main() {}" )
85+ . file (
86+ ".cargo/config" ,
87+ r#"
88+ [alias]
89+ echo = "build"
90+ "# ,
91+ )
92+ . build ( ) ;
93+
94+ let mut paths: Vec < _ > = env:: split_paths ( & env:: var_os ( "PATH" ) . unwrap_or_default ( ) ) . collect ( ) ;
95+ paths. push ( echo. target_debug_dir ( ) ) ;
96+ let path = env:: join_paths ( paths) . unwrap ( ) ;
97+
98+ p. cargo ( "echo" )
99+ . env ( "PATH" , & path)
100+ . with_stderr ( "\
101+ [WARNING] user-defined alias `echo` is shadowing an external subcommand found at: `[ROOT]/cargo-echo/target/debug/cargo-echo[EXE]`
102+ This was previously accepted but is being phased out; it will become a hard error in a future release.
103+ For more information, see issue #10049 <https://github.com/rust-lang/cargo/issues/10049>.
104+ [COMPILING] foo v0.5.0 [..]
105+ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
106+ " ,
107+ )
108+ . run ( ) ;
109+ }
110+
79111#[ cargo_test]
80112fn default_args_alias ( ) {
81113 let echo = echo_subcommand ( ) ;
You can’t perform that action at this time.
0 commit comments