File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -1308,6 +1308,13 @@ impl TomlManifest {
13081308 . as_ref ( )
13091309 . or_else ( || platform. build_dependencies2 . as_ref ( ) ) ;
13101310 process_dependencies ( & mut cx, build_deps, Some ( DepKind :: Build ) ) ?;
1311+ if platform. dev_dependencies . is_some ( ) && platform. dev_dependencies2 . is_some ( ) {
1312+ cx. warnings . push ( format ! (
1313+ "found both `dev-dependencies` and `dev_dependencies` are set \
1314+ in the `{}` platform target",
1315+ name
1316+ ) ) ;
1317+ }
13111318 let dev_deps = platform
13121319 . dev_dependencies
13131320 . as_ref ( )
Original file line number Diff line number Diff line change @@ -3023,6 +3023,46 @@ fn cargo_platform_specific_dependency_build_dependencies_conflicting_warning() {
30233023 assert ! ( p. bin( "foo" ) . is_file( ) ) ;
30243024}
30253025
3026+ #[ cargo_test]
3027+ fn cargo_platform_specific_dependency_dev_dependencies_conflicting_warning ( ) {
3028+ let host = rustc_host ( ) ;
3029+ let p = project ( )
3030+ . file (
3031+ "Cargo.toml" ,
3032+ & format ! (
3033+ r#"
3034+ [project]
3035+ name = "foo"
3036+ version = "0.5.0"
3037+ authors = ["wycats@example.com"]
3038+
3039+ [target.{host}.dev-dependencies]
3040+ dev = {{ path = "dev" }}
3041+ [target.{host}.dev_dependencies]
3042+ dev = {{ path = "dev" }}
3043+ "# ,
3044+ host = host
3045+ ) ,
3046+ )
3047+ . file ( "src/main.rs" , "fn main() { }" )
3048+ . file (
3049+ "tests/foo.rs" ,
3050+ "extern crate dev; #[test] fn foo() { dev::dev() }" ,
3051+ )
3052+ . file ( "dev/Cargo.toml" , & basic_manifest ( "dev" , "0.5.0" ) )
3053+ . file ( "dev/src/lib.rs" , "pub fn dev() {}" )
3054+ . build ( ) ;
3055+
3056+ p. cargo ( "build" )
3057+ . with_stderr_contains (
3058+ format ! ( "[WARNING] found both `dev-dependencies` and `dev_dependencies` are set in the `{}` platform target" , host) ,
3059+ )
3060+ . run ( ) ;
3061+
3062+ assert ! ( p. bin( "foo" ) . is_file( ) ) ;
3063+ p. cargo ( "test" ) . run ( ) ;
3064+ }
3065+
30263066#[ cargo_test]
30273067fn bad_platform_specific_dependency ( ) {
30283068 let p = project ( )
You can’t perform that action at this time.
0 commit comments