File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,56 @@ fn features_with_namespaced_features() {
141
141
. run ( ) ;
142
142
}
143
143
144
+ #[ cargo_test( nightly, reason = "--check-cfg is unstable" ) ]
145
+ fn features_fingerprint ( ) {
146
+ let p = project ( )
147
+ . file (
148
+ "Cargo.toml" ,
149
+ r#"
150
+ [package]
151
+ name = "foo"
152
+ version = "0.1.0"
153
+
154
+ [features]
155
+ f_a = []
156
+ f_b = []
157
+ "# ,
158
+ )
159
+ . file ( "src/lib.rs" , "#[cfg(feature = \" f_b\" )] fn entry() {}" )
160
+ . build ( ) ;
161
+
162
+ p. cargo ( "check -v -Zcheck-cfg" )
163
+ . masquerade_as_nightly_cargo ( & [ "check-cfg" ] )
164
+ . with_stderr_contains ( x ! ( "rustc" => "cfg" of "feature" with "f_a" "f_b" ) )
165
+ . with_stderr_does_not_contain ( "[..]unexpected_cfgs[..]" )
166
+ . run ( ) ;
167
+
168
+ p. cargo ( "check -v -Zcheck-cfg" )
169
+ . masquerade_as_nightly_cargo ( & [ "check-cfg" ] )
170
+ . with_stderr_does_not_contain ( "[..]rustc[..]" )
171
+ . run ( ) ;
172
+
173
+ p. change_file (
174
+ "Cargo.toml" ,
175
+ r#"
176
+ [package]
177
+ name = "foo"
178
+ version = "0.1.0"
179
+
180
+ [features]
181
+ f_a = []
182
+ "# ,
183
+ ) ;
184
+
185
+ p. cargo ( "check -v -Zcheck-cfg" )
186
+ . masquerade_as_nightly_cargo ( & [ "check-cfg" ] )
187
+ // this is a bug, rustc should be called again
188
+ . with_stderr_does_not_contain ( "[..]rustc[..]" )
189
+ // and should show a warning from the unexpected_cfgs lint
190
+ . with_stderr_does_not_contain ( "[..]unexpected_cfgs[..]" )
191
+ . run ( ) ;
192
+ }
193
+
144
194
#[ cargo_test( nightly, reason = "--check-cfg is unstable" ) ]
145
195
fn well_known_names_values ( ) {
146
196
let p = project ( )
You can’t perform that action at this time.
0 commit comments