@@ -538,51 +538,67 @@ impl Features {
538
538
}
539
539
}
540
540
541
- /// A parsed representation of all unstable flags that Cargo accepts.
542
- ///
543
- /// Cargo, like `rustc`, accepts a suite of `-Z` flags which are intended for
544
- /// gating unstable functionality to Cargo. These flags are only available on
545
- /// the nightly channel of Cargo.
546
- #[ derive( Default , Debug , Deserialize ) ]
547
- #[ serde( default , rename_all = "kebab-case" ) ]
548
- pub struct CliUnstable {
541
+ macro_rules! help_struct {
542
+ ( $name: ident, $( $visibility: vis $element: ident: $ty: ty = ( $help: literal $( , #[ $meta: meta] ) ?) ) ,* ) => {
543
+ /// A parsed representation of all unstable flags that Cargo accepts.
544
+ ///
545
+ /// Cargo, like `rustc`, accepts a suite of `-Z` flags which are intended for
546
+ /// gating unstable functionality to Cargo. These flags are only available on
547
+ /// the nightly channel of Cargo.
548
+ #[ derive( Default , Debug , Deserialize ) ]
549
+ #[ serde( default , rename_all = "kebab-case" ) ]
550
+ pub struct $name {
551
+ $(
552
+ $( #[ $meta] ) ?
553
+ $visibility $element: $ty
554
+ ) ,*
555
+ }
556
+ impl $name {
557
+ pub fn help( ) -> Vec <( & ' static str , & ' static str ) > {
558
+ let fields = vec![ $( ( stringify!( $element) , $help) ) ,* ] ;
559
+ fields
560
+ }
561
+ }
562
+ }
563
+ }
564
+
565
+ help_struct ! ( CliUnstable ,
549
566
// Permanently unstable features:
550
- pub allow_features : Option < BTreeSet < String > > ,
551
- pub print_im_a_teapot : bool ,
567
+ pub allow_features: Option <BTreeSet <String >> = ( "Allow *only* the listed unstable features" ) ,
568
+ pub print_im_a_teapot: bool = ( "" ) ,
552
569
553
570
// All other unstable features.
554
571
// Please keep this list lexiographically ordered.
555
- pub advanced_env : bool ,
556
- pub avoid_dev_deps : bool ,
557
- pub binary_dep_depinfo : bool ,
558
- #[ serde( deserialize_with = "deserialize_build_std" ) ]
559
- pub build_std : Option < Vec < String > > ,
560
- pub build_std_features : Option < Vec < String > > ,
561
- pub config_include : bool ,
562
- pub configurable_env : bool ,
563
- pub credential_process : bool ,
564
- pub doctest_in_workspace : bool ,
565
- pub doctest_xcompile : bool ,
566
- pub dual_proc_macros : bool ,
567
- pub enable_future_incompat_feature : bool ,
568
- pub extra_link_arg : bool ,
569
- pub features : Option < Vec < String > > ,
570
- pub jobserver_per_rustc : bool ,
571
- pub minimal_versions : bool ,
572
- pub mtime_on_use : bool ,
573
- pub multitarget : bool ,
574
- pub named_profiles : bool ,
575
- pub namespaced_features : bool ,
576
- pub no_index_update : bool ,
577
- pub panic_abort_tests : bool ,
578
- pub patch_in_config : bool ,
579
- pub rustdoc_map : bool ,
580
- pub separate_nightlies : bool ,
581
- pub terminal_width : Option < Option < usize > > ,
582
- pub timings : Option < Vec < String > > ,
583
- pub unstable_options : bool ,
584
- pub weak_dep_features : bool ,
585
- }
572
+ pub advanced_env: bool = ( "" ) ,
573
+ pub avoid_dev_deps: bool = ( "Avoid installing dev-dependencies if possible" ) ,
574
+ pub binary_dep_depinfo: bool = ( "" ) ,
575
+ pub build_std: Option <Vec <String >> = ( "" , #[ serde( deserialize_with = "deserialize_build_std" ) ] ) ,
576
+ pub build_std_features: Option <Vec <String >> = ( "" ) ,
577
+ pub config_include: bool = ( "" ) ,
578
+ pub configurable_env: bool = ( "" ) ,
579
+ pub credential_process: bool = ( "" ) ,
580
+ pub doctest_in_workspace: bool = ( "" ) ,
581
+ pub doctest_xcompile: bool = ( "Compile and run doctests for non-host target using runner config" ) ,
582
+ pub dual_proc_macros: bool = ( "" ) ,
583
+ pub enable_future_incompat_feature: bool = ( "" ) ,
584
+ pub extra_link_arg: bool = ( "Allow `cargo:rustc-link-arg` in build scripts" ) ,
585
+ pub features: Option <Vec <String >> = ( "" ) ,
586
+ pub jobserver_per_rustc: bool = ( "" ) ,
587
+ pub minimal_versions: bool = ( "Install minimal dependency versions instead of maximum" ) ,
588
+ pub mtime_on_use: bool = ( "" ) ,
589
+ pub multitarget: bool = ( "" ) ,
590
+ pub named_profiles: bool = ( "" ) ,
591
+ pub namespaced_features: bool = ( "Allow features with `dep:` prefix" ) ,
592
+ pub no_index_update: bool = ( "Do not update the registry, avoids a network request for benchmarking" ) ,
593
+ pub panic_abort_tests: bool = ( "" ) ,
594
+ pub patch_in_config: bool = ( "Allow `[patch]` sections in .cargo/config.toml files" ) ,
595
+ pub rustdoc_map: bool = ( "" ) ,
596
+ pub separate_nightlies: bool = ( "" ) ,
597
+ pub terminal_width: Option <Option <usize >> = ( "Provide a terminal width to rustc for error truncation" ) ,
598
+ pub timings: Option <Vec <String >> = ( "Display concurrency information" ) ,
599
+ pub unstable_options: bool = ( "Allow the usage of unstable options" ) ,
600
+ pub weak_dep_features: bool = ( "Allow `dep_name?/feature` feature syntax" )
601
+ ) ;
586
602
587
603
const STABILIZED_COMPILE_PROGRESS : & str = "The progress bar is now always \
588
604
enabled when used on an interactive console.\n \
0 commit comments