@@ -804,6 +804,309 @@ Caused by:
804
804
. run ( ) ;
805
805
}
806
806
807
+ #[ cargo_test]
808
+ fn dev_dependencies2_conflict ( ) {
809
+ let p = project ( )
810
+ . file (
811
+ "Cargo.toml" ,
812
+ r#"
813
+ [package]
814
+ name = "foo"
815
+ version = "0.1.0"
816
+ edition = "2018"
817
+
818
+ [dev-dependencies]
819
+ a = {path = "a"}
820
+ [dev_dependencies]
821
+ a = {path = "a"}
822
+ "# ,
823
+ )
824
+ . file ( "src/lib.rs" , "" )
825
+ . file (
826
+ "a/Cargo.toml" ,
827
+ r#"
828
+ [package]
829
+ name = "a"
830
+ version = "0.0.1"
831
+ edition = "2015"
832
+ "# ,
833
+ )
834
+ . file ( "a/src/lib.rs" , "" )
835
+ . build ( ) ;
836
+ p. cargo ( "build" )
837
+ . with_stderr_contains (
838
+ "[WARNING] conflicting between `dev-dependencies` and `dev_dependencies` in the `foo` package.\n
839
+ `dev_dependencies` is ignored and not recommended for use in the future"
840
+ )
841
+ . run ( ) ;
842
+ }
843
+
844
+ #[ cargo_test]
845
+ fn build_dependencies2_conflict ( ) {
846
+ let p = project ( )
847
+ . file (
848
+ "Cargo.toml" ,
849
+ r#"
850
+ [package]
851
+ name = "foo"
852
+ version = "0.1.0"
853
+ edition = "2018"
854
+
855
+ [build-dependencies]
856
+ a = {path = "a"}
857
+ [build_dependencies]
858
+ a = {path = "a"}
859
+ "# ,
860
+ )
861
+ . file ( "src/lib.rs" , "" )
862
+ . file (
863
+ "a/Cargo.toml" ,
864
+ r#"
865
+ [package]
866
+ name = "a"
867
+ version = "0.0.1"
868
+ edition = "2015"
869
+ "# ,
870
+ )
871
+ . file ( "a/src/lib.rs" , "" )
872
+ . build ( ) ;
873
+ p. cargo ( "build" )
874
+ . with_stderr_contains (
875
+ "[WARNING] conflicting between `build-dependencies` and `build_dependencies` in the `foo` package.\n
876
+ `build_dependencies` is ignored and not recommended for use in the future"
877
+ )
878
+ . run ( ) ;
879
+ }
880
+
881
+ #[ cargo_test]
882
+ fn lib_crate_type2_conflict ( ) {
883
+ let p = project ( )
884
+ . file (
885
+ "Cargo.toml" ,
886
+ r#"
887
+ [package]
888
+ name = "foo"
889
+ version = "0.5.0"
890
+ edition = "2015"
891
+ authors = ["wycats@example.com"]
892
+
893
+ [lib]
894
+ name = "foo"
895
+ crate-type = ["rlib", "dylib"]
896
+ crate_type = ["staticlib", "dylib"]
897
+ "# ,
898
+ )
899
+ . file ( "src/lib.rs" , "pub fn foo() {}" )
900
+ . build ( ) ;
901
+ p. cargo ( "build" )
902
+ . with_stderr_contains (
903
+ "[WARNING] conflicting between `crate-type` and `crate_type` in the `foo` library target.\n
904
+ `crate_type` is ignored and not recommended for use in the future" ,
905
+ )
906
+ . run ( ) ;
907
+ }
908
+
909
+ #[ cargo_test]
910
+ fn examples_crate_type2_conflict ( ) {
911
+ let p = project ( )
912
+ . file (
913
+ "Cargo.toml" ,
914
+ r#"
915
+ [package]
916
+ name = "foo"
917
+ version = "0.5.0"
918
+ edition = "2015"
919
+ authors = ["wycats@example.com"]
920
+
921
+ [[example]]
922
+ name = "ex"
923
+ path = "examples/ex.rs"
924
+ crate-type = ["rlib", "dylib"]
925
+ crate_type = ["proc_macro"]
926
+ [[example]]
927
+ name = "goodbye"
928
+ path = "examples/ex-goodbye.rs"
929
+ crate-type = ["rlib", "dylib"]
930
+ crate_type = ["rlib", "staticlib"]
931
+ "# ,
932
+ )
933
+ . file ( "src/lib.rs" , "" )
934
+ . file (
935
+ "examples/ex.rs" ,
936
+ r#"
937
+ fn main() { println!("ex"); }
938
+ "# ,
939
+ )
940
+ . file (
941
+ "examples/ex-goodbye.rs" ,
942
+ r#"
943
+ fn main() { println!("goodbye"); }
944
+ "# ,
945
+ )
946
+ . build ( ) ;
947
+ p. cargo ( "build" )
948
+ . with_stderr_contains (
949
+ "\
950
+ [WARNING] conflicting between `crate-type` and `crate_type` in the `ex` example target.\n
951
+ `crate_type` is ignored and not recommended for use in the future
952
+ [WARNING] conflicting between `crate-type` and `crate_type` in the `goodbye` example target.\n
953
+ `crate_type` is ignored and not recommended for use in the future" ,
954
+ )
955
+ . run ( ) ;
956
+ }
957
+
958
+ #[ cargo_test]
959
+ fn cargo_platform_build_dependencies2_conflict ( ) {
960
+ let host = rustc_host ( ) ;
961
+ let p = project ( )
962
+ . file (
963
+ "Cargo.toml" ,
964
+ & format ! (
965
+ r#"
966
+ [package]
967
+ name = "foo"
968
+ version = "0.5.0"
969
+ edition = "2015"
970
+ authors = ["wycats@example.com"]
971
+ build = "build.rs"
972
+
973
+ [target.{host}.build-dependencies]
974
+ build = {{ path = "build" }}
975
+ [target.{host}.build_dependencies]
976
+ build = {{ path = "build" }}
977
+ "# ,
978
+ host = host
979
+ ) ,
980
+ )
981
+ . file ( "src/main.rs" , "fn main() { }" )
982
+ . file (
983
+ "build.rs" ,
984
+ "extern crate build; fn main() { build::build(); }" ,
985
+ )
986
+ . file ( "build/Cargo.toml" , & basic_manifest ( "build" , "0.5.0" ) )
987
+ . file ( "build/src/lib.rs" , "pub fn build() {}" )
988
+ . build ( ) ;
989
+
990
+ p. cargo ( "build" )
991
+ . with_stderr_contains (
992
+ format ! ( "[WARNING] conflicting between `build-dependencies` and `build_dependencies` in the `{}` platform target.\n
993
+ `build_dependencies` is ignored and not recommended for use in the future" , host)
994
+ )
995
+ . run ( ) ;
996
+
997
+ assert ! ( p. bin( "foo" ) . is_file( ) ) ;
998
+ }
999
+
1000
+ #[ cargo_test]
1001
+ fn cargo_platform_dev_dependencies2_conflict ( ) {
1002
+ let host = rustc_host ( ) ;
1003
+ let p = project ( )
1004
+ . file (
1005
+ "Cargo.toml" ,
1006
+ & format ! (
1007
+ r#"
1008
+ [package]
1009
+ name = "foo"
1010
+ version = "0.5.0"
1011
+ edition = "2015"
1012
+ authors = ["wycats@example.com"]
1013
+
1014
+ [target.{host}.dev-dependencies]
1015
+ dev = {{ path = "dev" }}
1016
+ [target.{host}.dev_dependencies]
1017
+ dev = {{ path = "dev" }}
1018
+ "# ,
1019
+ host = host
1020
+ ) ,
1021
+ )
1022
+ . file ( "src/main.rs" , "fn main() { }" )
1023
+ . file (
1024
+ "tests/foo.rs" ,
1025
+ "extern crate dev; #[test] fn foo() { dev::dev() }" ,
1026
+ )
1027
+ . file ( "dev/Cargo.toml" , & basic_manifest ( "dev" , "0.5.0" ) )
1028
+ . file ( "dev/src/lib.rs" , "pub fn dev() {}" )
1029
+ . build ( ) ;
1030
+
1031
+ p. cargo ( "build" )
1032
+ . with_stderr_contains (
1033
+ format ! ( "[WARNING] conflicting between `dev-dependencies` and `dev_dependencies` in the `{}` platform target.\n
1034
+ `dev_dependencies` is ignored and not recommended for use in the future" , host)
1035
+ )
1036
+ . run ( ) ;
1037
+
1038
+ assert ! ( p. bin( "foo" ) . is_file( ) ) ;
1039
+ p. cargo ( "test" ) . run ( ) ;
1040
+ }
1041
+
1042
+ #[ cargo_test]
1043
+ fn default_features2_conflict ( ) {
1044
+ let p = project ( )
1045
+ . file (
1046
+ "Cargo.toml" ,
1047
+ r#"
1048
+ [package]
1049
+ name = "foo"
1050
+ version = "0.1.0"
1051
+ edition = "2015"
1052
+ authors = []
1053
+
1054
+ [dependencies]
1055
+ a = { path = "a", features = ["f1"], default-features = false, default_features = false }
1056
+ "# ,
1057
+ )
1058
+ . file ( "src/lib.rs" , "" )
1059
+ . file (
1060
+ "a/Cargo.toml" ,
1061
+ r#"
1062
+ [package]
1063
+ name = "a"
1064
+ version = "0.1.0"
1065
+ edition = "2015"
1066
+ authors = []
1067
+
1068
+ [features]
1069
+ default = ["f1"]
1070
+ f1 = []
1071
+ "# ,
1072
+ )
1073
+ . file ( "a/src/lib.rs" , "" )
1074
+ . build ( ) ;
1075
+
1076
+ p. cargo ( "check" )
1077
+ . with_stderr_contains (
1078
+ "[WARNING] conflicting between `default-features` and `default_features` in the `a` dependency.\n
1079
+ `default_features` is ignored and not recommended for use in the future"
1080
+ )
1081
+ . run ( ) ;
1082
+ }
1083
+
1084
+ #[ cargo_test]
1085
+ fn proc_macro2_conflict ( ) {
1086
+ let foo = project ( )
1087
+ . file (
1088
+ "Cargo.toml" ,
1089
+ r#"
1090
+ [package]
1091
+ name = "foo"
1092
+ version = "0.1.0"
1093
+ edition = "2015"
1094
+ [lib]
1095
+ proc-macro = false
1096
+ proc_macro = true
1097
+ "# ,
1098
+ )
1099
+ . file ( "src/lib.rs" , "" )
1100
+ . build ( ) ;
1101
+
1102
+ foo. cargo ( "check" )
1103
+ . with_stderr_contains (
1104
+ "[WARNING] conflicting between `proc-macro` and `proc_macro` in the `foo` library target.\n
1105
+ `proc_macro` is ignored and not recommended for use in the future" ,
1106
+ )
1107
+ . run ( ) ;
1108
+ }
1109
+
807
1110
#[ cargo_test]
808
1111
fn invalid_toml_historically_allowed_fails ( ) {
809
1112
let p = project ( )
0 commit comments