@@ -732,7 +732,7 @@ fn prepare_rustdoc(build_runner: &BuildRunner<'_, '_>, unit: &Unit) -> CargoResu
732
732
let doc_dir = build_runner. files ( ) . out_dir ( unit) ;
733
733
rustdoc. arg ( "-o" ) . arg ( & doc_dir) ;
734
734
rustdoc. args ( & features_args ( unit) ) ;
735
- rustdoc. args ( & check_cfg_args ( build_runner , unit) ) ;
735
+ rustdoc. args ( & check_cfg_args ( unit) ) ;
736
736
737
737
add_error_format_and_color ( build_runner, & mut rustdoc) ;
738
738
add_allow_features ( build_runner, & mut rustdoc) ;
@@ -1125,7 +1125,7 @@ fn build_base_args(
1125
1125
}
1126
1126
1127
1127
cmd. args ( & features_args ( unit) ) ;
1128
- cmd. args ( & check_cfg_args ( build_runner , unit) ) ;
1128
+ cmd. args ( & check_cfg_args ( unit) ) ;
1129
1129
1130
1130
let meta = build_runner. files ( ) . metadata ( unit) ;
1131
1131
cmd. arg ( "-C" ) . arg ( & format ! ( "metadata={}" , meta) ) ;
@@ -1310,57 +1310,51 @@ fn trim_paths_args(
1310
1310
}
1311
1311
1312
1312
/// Generates the `--check-cfg` arguments for the `unit`.
1313
- /// See unstable feature [`check-cfg`].
1314
1313
///
1315
1314
/// [`check-cfg`]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg
1316
- fn check_cfg_args ( build_runner : & BuildRunner < ' _ , ' _ > , unit : & Unit ) -> Vec < OsString > {
1317
- if build_runner. bcx . gctx . cli_unstable ( ) . check_cfg {
1318
- // The routine below generates the --check-cfg arguments. Our goals here are to
1319
- // enable the checking of conditionals and pass the list of declared features.
1320
- //
1321
- // In the simplified case, it would resemble something like this:
1322
- //
1323
- // --check-cfg=cfg() --check-cfg=cfg(feature, values(...))
1324
- //
1325
- // but having `cfg()` is redundant with the second argument (as well-known names
1326
- // and values are implicitly enabled when one or more `--check-cfg` argument is
1327
- // passed) so we don't emit it and just pass:
1328
- //
1329
- // --check-cfg=cfg(feature, values(...))
1330
- //
1331
- // This way, even if there are no declared features, the config `feature` will
1332
- // still be expected, meaning users would get "unexpected value" instead of name.
1333
- // This wasn't always the case, see rust-lang#119930 for some details.
1315
+ fn check_cfg_args ( unit : & Unit ) -> Vec < OsString > {
1316
+ // The routine below generates the --check-cfg arguments. Our goals here are to
1317
+ // enable the checking of conditionals and pass the list of declared features.
1318
+ //
1319
+ // In the simplified case, it would resemble something like this:
1320
+ //
1321
+ // --check-cfg=cfg() --check-cfg=cfg(feature, values(...))
1322
+ //
1323
+ // but having `cfg()` is redundant with the second argument (as well-known names
1324
+ // and values are implicitly enabled when one or more `--check-cfg` argument is
1325
+ // passed) so we don't emit it and just pass:
1326
+ //
1327
+ // --check-cfg=cfg(feature, values(...))
1328
+ //
1329
+ // This way, even if there are no declared features, the config `feature` will
1330
+ // still be expected, meaning users would get "unexpected value" instead of name.
1331
+ // This wasn't always the case, see rust-lang#119930 for some details.
1334
1332
1335
- let gross_cap_estimation = unit. pkg . summary ( ) . features ( ) . len ( ) * 7 + 25 ;
1336
- let mut arg_feature = OsString :: with_capacity ( gross_cap_estimation) ;
1333
+ let gross_cap_estimation = unit. pkg . summary ( ) . features ( ) . len ( ) * 7 + 25 ;
1334
+ let mut arg_feature = OsString :: with_capacity ( gross_cap_estimation) ;
1337
1335
1338
- arg_feature. push ( "cfg(feature, values(" ) ;
1339
- for ( i, feature) in unit. pkg . summary ( ) . features ( ) . keys ( ) . enumerate ( ) {
1340
- if i != 0 {
1341
- arg_feature. push ( ", " ) ;
1342
- }
1343
- arg_feature. push ( "\" " ) ;
1344
- arg_feature. push ( feature) ;
1345
- arg_feature. push ( "\" " ) ;
1336
+ arg_feature. push ( "cfg(feature, values(" ) ;
1337
+ for ( i, feature) in unit. pkg . summary ( ) . features ( ) . keys ( ) . enumerate ( ) {
1338
+ if i != 0 {
1339
+ arg_feature. push ( ", " ) ;
1346
1340
}
1347
- arg_feature. push ( ")) " ) ;
1348
-
1349
- // We also include the `docsrs` cfg from the docs.rs service. We include it here
1350
- // (in Cargo) instead of rustc, since there is a much closer relationship between
1351
- // Cargo and docs.rs than rustc and docs.rs. In particular, all users of docs.rs use
1352
- // Cargo, but not all users of rustc (like Rust-for-Linux) use docs.rs.
1353
-
1354
- vec ! [
1355
- OsString :: from ( "-Zunstable-options" ) ,
1356
- OsString :: from ( "--check-cfg" ) ,
1357
- OsString :: from ( "cfg(docsrs)" ) ,
1358
- OsString :: from ( "--check-cfg" ) ,
1359
- arg_feature ,
1360
- ]
1361
- } else {
1362
- Vec :: new ( )
1363
- }
1341
+ arg_feature. push ( "\" " ) ;
1342
+ arg_feature . push ( feature ) ;
1343
+ arg_feature . push ( " \" " ) ;
1344
+ }
1345
+ arg_feature . push ( "))" ) ;
1346
+
1347
+ // We also include the `docsrs` cfg from the docs.rs service. We include it here
1348
+ // (in Cargo) instead of rustc, since there is a much closer relationship between
1349
+ // Cargo and docs.rs than rustc and docs.rs. In particular, all users of docs.rs use
1350
+ // Cargo, but not all users of rustc (like Rust-for-Linux) use docs.rs.
1351
+
1352
+ vec ! [
1353
+ OsString :: from ( "--check-cfg" ) ,
1354
+ OsString :: from ( "cfg(docsrs)" ) ,
1355
+ OsString :: from ( "--check-cfg" ) ,
1356
+ arg_feature ,
1357
+ ]
1364
1358
}
1365
1359
1366
1360
/// Adds LTO related codegen flags.
0 commit comments