@@ -1413,6 +1413,10 @@ pub struct RustcOptGroup {
1413
1413
long_name : & ' static str ,
1414
1414
desc : & ' static str ,
1415
1415
value_hint : & ' static str ,
1416
+
1417
+ /// If true, this option should not be printed by `rustc --help`, but
1418
+ /// should still be printed by `rustc --help -v`.
1419
+ pub is_verbose_help_only : bool ,
1416
1420
}
1417
1421
1418
1422
impl RustcOptGroup {
@@ -1452,6 +1456,7 @@ pub fn make_opt(
1452
1456
long_name,
1453
1457
desc,
1454
1458
value_hint,
1459
+ is_verbose_help_only : false ,
1455
1460
}
1456
1461
}
1457
1462
@@ -1462,16 +1467,15 @@ The default is {DEFAULT_EDITION} and the latest stable edition is {LATEST_STABLE
1462
1467
)
1463
1468
} ) ;
1464
1469
1465
- /// Returns the "short" subset of the rustc command line options,
1466
- /// including metadata for each option, such as whether the option is
1467
- /// part of the stable long-term interface for rustc.
1468
- pub fn rustc_short_optgroups ( ) -> Vec < RustcOptGroup > {
1470
+ /// Returns all rustc command line options, including metadata for
1471
+ /// each option, such as whether the option is stable.
1472
+ pub fn rustc_optgroups ( ) -> Vec < RustcOptGroup > {
1469
1473
use OptionKind :: { Flag , FlagMulti , Multi , Opt } ;
1470
- use OptionStability :: Stable ;
1474
+ use OptionStability :: { Stable , Unstable } ;
1471
1475
1472
1476
use self :: make_opt as opt;
1473
1477
1474
- vec ! [
1478
+ let mut options = vec ! [
1475
1479
opt( Stable , Flag , "h" , "help" , "Display this message" , "" ) ,
1476
1480
opt(
1477
1481
Stable ,
@@ -1558,21 +1562,11 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
1558
1562
opt( Stable , Multi , "C" , "codegen" , "Set a codegen option" , "OPT[=VALUE]" ) ,
1559
1563
opt( Stable , Flag , "V" , "version" , "Print version info and exit" , "" ) ,
1560
1564
opt( Stable , Flag , "v" , "verbose" , "Use verbose output" , "" ) ,
1561
- ]
1562
- }
1563
-
1564
- /// Returns all rustc command line options, including metadata for
1565
- /// each option, such as whether the option is part of the stable
1566
- /// long-term interface for rustc.
1567
- pub fn rustc_optgroups ( ) -> Vec < RustcOptGroup > {
1568
- use OptionKind :: { Multi , Opt } ;
1569
- use OptionStability :: { Stable , Unstable } ;
1570
-
1571
- use self :: make_opt as opt;
1565
+ ] ;
1572
1566
1573
- let mut opts = rustc_short_optgroups ( ) ;
1574
- // FIXME: none of these descriptions are actually used
1575
- opts . extend ( vec ! [
1567
+ // Options in this list are hidden from `rustc --help` by default, but are
1568
+ // shown by `rustc --help -v`.
1569
+ let verbose_only = [
1576
1570
opt (
1577
1571
Stable ,
1578
1572
Multi ,
@@ -1598,9 +1592,9 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
1598
1592
"" ,
1599
1593
"color" ,
1600
1594
"Configure coloring of output:
1601
- auto = colorize, if output goes to a tty (default);
1602
- always = always colorize output;
1603
- never = never colorize output" ,
1595
+ auto = colorize, if output goes to a tty (default);
1596
+ always = always colorize output;
1597
+ never = never colorize output" ,
1604
1598
"auto|always|never" ,
1605
1599
) ,
1606
1600
opt (
@@ -1620,8 +1614,13 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
1620
1614
"FROM=TO" ,
1621
1615
) ,
1622
1616
opt ( Unstable , Multi , "" , "env-set" , "Inject an environment variable" , "VAR=VALUE" ) ,
1623
- ] ) ;
1624
- opts
1617
+ ] ;
1618
+ options. extend ( verbose_only. into_iter ( ) . map ( |mut opt| {
1619
+ opt. is_verbose_help_only = true ;
1620
+ opt
1621
+ } ) ) ;
1622
+
1623
+ options
1625
1624
}
1626
1625
1627
1626
pub fn get_cmd_lint_options (
0 commit comments