@@ -1462,45 +1462,39 @@ impl<'a> Builder<'a> {
14621462 rustflags. arg ( "-Zunstable-options" ) ;
14631463 }
14641464
1465- // FIXME(Urgau): This a hack as it shouldn't be gated on stage 0 but until `rustc_llvm`
1466- // is made to work with `--check-cfg` which is currently not easly possible until cargo
1467- // get some support for setting `--check-cfg` within build script, it's the least invasive
1468- // hack that still let's us have cfg checking for the vast majority of the codebase.
1469- if stage != 0 {
1470- // Enable cfg checking of cargo features for everything but std and also enable cfg
1471- // checking of names and values.
1472- //
1473- // Note: `std`, `alloc` and `core` imports some dependencies by #[path] (like
1474- // backtrace, core_simd, std_float, ...), those dependencies have their own
1475- // features but cargo isn't involved in the #[path] process and so cannot pass the
1476- // complete list of features, so for that reason we don't enable checking of
1477- // features for std crates.
1478- cargo. arg ( if mode != Mode :: Std {
1479- "-Zcheck-cfg=names,values,features"
1480- } else {
1481- "-Zcheck-cfg=names,values"
1482- } ) ;
1465+ // Enable cfg checking of cargo features for everything but std and also enable cfg
1466+ // checking of names and values.
1467+ //
1468+ // Note: `std`, `alloc` and `core` imports some dependencies by #[path] (like
1469+ // backtrace, core_simd, std_float, ...), those dependencies have their own
1470+ // features but cargo isn't involved in the #[path] process and so cannot pass the
1471+ // complete list of features, so for that reason we don't enable checking of
1472+ // features for std crates.
1473+ cargo. arg ( if mode != Mode :: Std {
1474+ "-Zcheck-cfg=names,values,output,features"
1475+ } else {
1476+ "-Zcheck-cfg=names,values,output"
1477+ } ) ;
14831478
1484- // Add extra cfg not defined in/by rustc
1485- //
1486- // Note: Altrough it would seems that "-Zunstable-options" to `rustflags` is useless as
1487- // cargo would implicitly add it, it was discover that sometimes bootstrap only use
1488- // `rustflags` without `cargo` making it required.
1489- rustflags. arg ( "-Zunstable-options" ) ;
1490- for ( restricted_mode, name, values) in EXTRA_CHECK_CFGS {
1491- if * restricted_mode == None || * restricted_mode == Some ( mode) {
1492- // Creating a string of the values by concatenating each value:
1493- // ',"tvos","watchos"' or '' (nothing) when there are no values
1494- let values = match values {
1495- Some ( values) => values
1496- . iter ( )
1497- . map ( |val| [ "," , "\" " , val, "\" " ] )
1498- . flatten ( )
1499- . collect :: < String > ( ) ,
1500- None => String :: new ( ) ,
1501- } ;
1502- rustflags. arg ( & format ! ( "--check-cfg=values({name}{values})" ) ) ;
1503- }
1479+ // Add extra cfg not defined in/by rustc
1480+ //
1481+ // Note: Altrough it would seems that "-Zunstable-options" to `rustflags` is useless as
1482+ // cargo would implicitly add it, it was discover that sometimes bootstrap only use
1483+ // `rustflags` without `cargo` making it required.
1484+ rustflags. arg ( "-Zunstable-options" ) ;
1485+ for ( restricted_mode, name, values) in EXTRA_CHECK_CFGS {
1486+ if * restricted_mode == None || * restricted_mode == Some ( mode) {
1487+ // Creating a string of the values by concatenating each value:
1488+ // ',"tvos","watchos"' or '' (nothing) when there are no values
1489+ let values = match values {
1490+ Some ( values) => values
1491+ . iter ( )
1492+ . map ( |val| [ "," , "\" " , val, "\" " ] )
1493+ . flatten ( )
1494+ . collect :: < String > ( ) ,
1495+ None => String :: new ( ) ,
1496+ } ;
1497+ rustflags. arg ( & format ! ( "--check-cfg=values({name}{values})" ) ) ;
15041498 }
15051499 }
15061500
0 commit comments