@@ -860,10 +860,39 @@ fn unexpected_cfgs_target() {
860
860
. file ( "c/src/lib.rs" , "" )
861
861
. build ( ) ;
862
862
863
- p. cargo ( "check -Zcheck-target-cfgs" )
863
+ p. cargo ( "check -Zcargo-lints - Zcheck-target-cfgs" )
864
864
. masquerade_as_nightly_cargo ( & [ "requires -Zcheck-target-cfgs" ] )
865
- // FIXME: We should warn on multiple cfgs
866
865
. with_stderr_data ( str![ [ r#"
866
+ [WARNING] unexpected `cfg` condition name: foo
867
+ --> Cargo.toml:11:25
868
+ |
869
+ 11 | [target."cfg(any(foo, all(bar)))".dependencies]
870
+ | -------------------------
871
+ |
872
+ [WARNING] unexpected `cfg` condition name: bar
873
+ --> Cargo.toml:11:25
874
+ |
875
+ 11 | [target."cfg(any(foo, all(bar)))".dependencies]
876
+ | -------------------------
877
+ |
878
+ [WARNING] unexpected `cfg` condition value: `` for `windows = ""`
879
+ --> Cargo.toml:18:25
880
+ |
881
+ 18 | [target.'cfg(not(windows = ""))'.dependencies]
882
+ | ------------------------
883
+ |
884
+ [WARNING] unexpected `cfg` condition value: `zoo` for `unix = "zoo"`
885
+ --> Cargo.toml:14:25
886
+ |
887
+ 14 | [target.'cfg(unix = "zoo")'.dependencies]
888
+ | -------------------
889
+ |
890
+ [WARNING] unexpected `cfg` condition value: `zoo` for `unix = "zoo"`
891
+ --> Cargo.toml:14:25
892
+ |
893
+ 14 | [target.'cfg(unix = "zoo")'.dependencies]
894
+ | -------------------
895
+ |
867
896
[LOCKING] 2 packages to latest compatible versions
868
897
[CHECKING] b v0.0.1 ([ROOT]/foo/b)
869
898
[CHECKING] a v0.0.1 ([ROOT]/foo)
@@ -910,10 +939,28 @@ fn unexpected_cfgs_target_with_lint() {
910
939
. file ( "b/src/lib.rs" , "" )
911
940
. build ( ) ;
912
941
913
- p. cargo ( "check -Zcheck-target-cfgs" )
942
+ p. cargo ( "check -Zcargo-lints - Zcheck-target-cfgs" )
914
943
. masquerade_as_nightly_cargo ( & [ "requires -Zcheck-target-cfgs" ] )
915
- // FIXME: We should warn on multiple cfgs
944
+ // FIXME: We should not warn on `cfg(foo = "foo")` but we currently do
916
945
. with_stderr_data ( str![ [ r#"
946
+ [WARNING] unexpected `cfg` condition name: bar
947
+ --> Cargo.toml:14:25
948
+ |
949
+ 14 | [target."cfg(bar)".dependencies]
950
+ | ----------
951
+ |
952
+ [WARNING] unexpected `cfg` condition name: foo for `foo = "foo"`
953
+ --> Cargo.toml:11:25
954
+ |
955
+ 11 | [target.'cfg(foo = "foo")'.dependencies] # should not warn here
956
+ | ------------------
957
+ |
958
+ [WARNING] unexpected `cfg` condition name: foo
959
+ --> Cargo.toml:8:25
960
+ |
961
+ 8 | [target."cfg(foo)".dependencies] # should not warn here
962
+ | ----------
963
+ |
917
964
[LOCKING] 1 package to latest compatible version
918
965
[CHECKING] a v0.0.1 ([ROOT]/foo)
919
966
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
@@ -934,10 +981,10 @@ fn unexpected_cfgs_target_diagnostics() {
934
981
edition = "2015"
935
982
authors = []
936
983
937
- [target."cfg(target_pointer_width)".dependencies]
984
+ [target."cfg(target_pointer_width)".dependencies] # expect (none) as value
938
985
b = { path = 'b' }
939
986
940
- [target.'cfg( all(foo , bar))'.dependencies]
987
+ [target.'cfg( all(foo , bar))'.dependencies] # no snippet due to weird formatting
941
988
b = { path = 'b' }
942
989
"# ,
943
990
)
@@ -946,9 +993,19 @@ fn unexpected_cfgs_target_diagnostics() {
946
993
. file ( "b/src/lib.rs" , "" )
947
994
. build ( ) ;
948
995
949
- p. cargo ( "check -Zcheck-target-cfgs" )
996
+ p. cargo ( "check -Zcargo-lints - Zcheck-target-cfgs" )
950
997
. masquerade_as_nightly_cargo ( & [ "requires -Zcheck-target-cfgs" ] )
951
998
. with_stderr_data ( str![ [ r#"
999
+ [WARNING] unexpected `cfg` condition name: foo in `[target.'cfg(all(foo, bar))']`
1000
+ = [HELP] occurred in `[ROOT]/foo/Cargo.toml`
1001
+ [WARNING] unexpected `cfg` condition name: bar in `[target.'cfg(all(foo, bar))']`
1002
+ = [HELP] occurred in `[ROOT]/foo/Cargo.toml`
1003
+ [WARNING] unexpected `cfg` condition value: (none) for `target_pointer_width`
1004
+ --> Cargo.toml:8:25
1005
+ |
1006
+ 8 | [target."cfg(target_pointer_width)".dependencies] # expect (none) as value
1007
+ | ---------------------------
1008
+ |
952
1009
[LOCKING] 1 package to latest compatible version
953
1010
[CHECKING] a v0.0.1 ([ROOT]/foo)
954
1011
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
@@ -981,10 +1038,16 @@ fn unexpected_cfgs_target_lint_level_allow() {
981
1038
. file ( "b/src/lib.rs" , "" )
982
1039
. build ( ) ;
983
1040
984
- p. cargo ( "check -Zcheck-target-cfgs" )
1041
+ p. cargo ( "check -Zcargo-lints - Zcheck-target-cfgs" )
985
1042
. masquerade_as_nightly_cargo ( & [ "requires -Zcheck-target-cfgs" ] )
986
- // FIXME: We should warn on multiple cfgs
1043
+ // FIXME: We shouldn't warn any target cfgs because of the level="allow"
987
1044
. with_stderr_data ( str![ [ r#"
1045
+ [WARNING] unexpected `cfg` condition name: foo
1046
+ --> Cargo.toml:8:25
1047
+ |
1048
+ 8 | [target."cfg(foo)".dependencies]
1049
+ | ----------
1050
+ |
988
1051
[LOCKING] 1 package to latest compatible version
989
1052
[CHECKING] a v0.0.1 ([ROOT]/foo)
990
1053
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
@@ -1017,9 +1080,15 @@ fn unexpected_cfgs_target_lint_level_deny() {
1017
1080
. file ( "b/src/lib.rs" , "" )
1018
1081
. build ( ) ;
1019
1082
1020
- p. cargo ( "check -Zcheck-target-cfgs" )
1083
+ p. cargo ( "check -Zcargo-lints - Zcheck-target-cfgs" )
1021
1084
. masquerade_as_nightly_cargo ( & [ "requires -Zcheck-target-cfgs" ] )
1022
1085
. with_stderr_data ( str![ [ r#"
1086
+ [WARNING] unexpected `cfg` condition name: foo
1087
+ --> Cargo.toml:8:25
1088
+ |
1089
+ 8 | [target."cfg(foo)".dependencies]
1090
+ | ----------
1091
+ |
1023
1092
[LOCKING] 1 package to latest compatible version
1024
1093
[CHECKING] a v0.0.1 ([ROOT]/foo)
1025
1094
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
@@ -1055,9 +1124,16 @@ fn unexpected_cfgs_target_cfg_any() {
1055
1124
. file ( "b/src/lib.rs" , "" )
1056
1125
. build ( ) ;
1057
1126
1058
- p. cargo ( "check -Zcheck-target-cfgs" )
1127
+ p. cargo ( "check -Zcargo-lints - Zcheck-target-cfgs" )
1059
1128
. masquerade_as_nightly_cargo ( & [ "requires -Zcheck-target-cfgs" ] )
1129
+ // FIXME: We shouldn't be linting `cfg(foo)` because of the `cfg(any())`
1060
1130
. with_stderr_data ( str![ [ r#"
1131
+ [WARNING] unexpected `cfg` condition name: foo
1132
+ --> Cargo.toml:8:25
1133
+ |
1134
+ 8 | [target."cfg(foo)".dependencies]
1135
+ | ----------
1136
+ |
1061
1137
[LOCKING] 1 package to latest compatible version
1062
1138
[CHECKING] a v0.0.1 ([ROOT]/foo)
1063
1139
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
@@ -1110,9 +1186,6 @@ fn no_unexpected_cfgs_target() {
1110
1186
p. cargo ( "check -Zcargo-lints" )
1111
1187
. masquerade_as_nightly_cargo ( & [ "requires -Zcargo-lints" ] )
1112
1188
. with_stderr_data ( str![ [ r#"
1113
- [LOCKING] 1 package to latest compatible version
1114
- [CHECKING] b v0.0.1 ([ROOT]/foo/b)
1115
- [CHECKING] a v0.0.1 ([ROOT]/foo)
1116
1189
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
1117
1190
1118
1191
"# ] ] )
0 commit comments