File tree 2 files changed +29
-3
lines changed
src/cargo/core/compiler/fingerprint
2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change 80
80
//! config settings[^5] | ✓ |
81
81
//! is_std | | ✓
82
82
//! `[lints]` table[^6] | ✓ |
83
+ //! `[lints.rust.unexpected_cfgs.check-cfg]` | ✓ |
83
84
//!
84
85
//! [^1]: Build script and bin dependencies are not included.
85
86
//!
@@ -1420,12 +1421,34 @@ fn calculate_normal(
1420
1421
}
1421
1422
. to_vec ( ) ;
1422
1423
1424
+ // Include all the args from `[lints.rust.unexpected_cfgs.check-cfg]`
1425
+ //
1426
+ // HACK(#13975): duplicating the lookup logic here until `--check-cfg` is supported
1427
+ // on Cargo's MSRV and we can centralize the logic in `lints_to_rustflags`
1428
+ let mut lint_check_cfg = Vec :: new ( ) ;
1429
+ if let Ok ( Some ( lints) ) = unit. pkg . manifest ( ) . resolved_toml ( ) . resolved_lints ( ) {
1430
+ if let Some ( rust_lints) = lints. get ( "rust" ) {
1431
+ if let Some ( unexpected_cfgs) = rust_lints. get ( "unexpected_cfgs" ) {
1432
+ if let Some ( config) = unexpected_cfgs. config ( ) {
1433
+ if let Some ( check_cfg) = config. get ( "check-cfg" ) {
1434
+ if let Ok ( check_cfgs) =
1435
+ toml:: Value :: try_into :: < Vec < String > > ( check_cfg. clone ( ) )
1436
+ {
1437
+ lint_check_cfg = check_cfgs;
1438
+ }
1439
+ }
1440
+ }
1441
+ }
1442
+ }
1443
+ }
1444
+
1423
1445
let profile_hash = util:: hash_u64 ( (
1424
1446
& unit. profile ,
1425
1447
unit. mode ,
1426
1448
build_runner. bcx . extra_args_for ( unit) ,
1427
1449
build_runner. lto [ unit] ,
1428
1450
unit. pkg . manifest ( ) . lint_rustflags ( ) ,
1451
+ lint_check_cfg,
1429
1452
) ) ;
1430
1453
// Include metadata since it is exposed as environment variables.
1431
1454
let m = unit. pkg . manifest ( ) . metadata ( ) ;
Original file line number Diff line number Diff line change @@ -851,8 +851,7 @@ fn config_fingerprint() {
851
851
. with_stderr_does_not_contain ( "[..]rustc[..]" )
852
852
. run ( ) ;
853
853
854
- // checking that changing the `-check-cfg` config does not invalid the fingerprint
855
- // FIXME: This should change the fingerprint
854
+ // checking that changing the `check-cfg` config does invalid the fingerprint
856
855
p. change_file (
857
856
"Cargo.toml" ,
858
857
r#"
@@ -867,6 +866,10 @@ fn config_fingerprint() {
867
866
) ;
868
867
869
868
p. cargo ( "check -v" )
870
- . with_stderr_does_not_contain ( "[..]rustc[..]" )
869
+ // we check that the fingerprint is indeed dirty
870
+ . with_stderr_contains ( "[..]Dirty[..]the profile configuration changed" )
871
+ // that cause rustc to be called again with the new check-cfg args
872
+ . with_stderr_contains ( x ! ( "rustc" => "cfg" of "bar" ) )
873
+ . with_stderr_contains ( x ! ( "rustc" => "cfg" of "foo" ) )
871
874
. run ( ) ;
872
875
}
You can’t perform that action at this time.
0 commit comments