@@ -1408,6 +1408,10 @@ pub struct RustcOptGroup {
14081408 long_name : & ' static str ,
14091409 desc : & ' static str ,
14101410 value_hint : & ' static str ,
1411+
1412+ /// If true, this option should not be printed by `rustc --help`, but
1413+ /// should still be printed by `rustc --help -v`.
1414+ pub is_verbose_help_only : bool ,
14111415}
14121416
14131417impl RustcOptGroup {
@@ -1447,6 +1451,7 @@ pub fn make_opt(
14471451 long_name,
14481452 desc,
14491453 value_hint,
1454+ is_verbose_help_only : false ,
14501455 }
14511456}
14521457
@@ -1457,16 +1462,15 @@ The default is {DEFAULT_EDITION} and the latest stable edition is {LATEST_STABLE
14571462 )
14581463} ) ;
14591464
1460- /// Returns the "short" subset of the rustc command line options,
1461- /// including metadata for each option, such as whether the option is
1462- /// part of the stable long-term interface for rustc.
1463- pub fn rustc_short_optgroups ( ) -> Vec < RustcOptGroup > {
1465+ /// Returns all rustc command line options, including metadata for
1466+ /// each option, such as whether the option is stable.
1467+ pub fn rustc_optgroups ( ) -> Vec < RustcOptGroup > {
14641468 use OptionKind :: { Flag , FlagMulti , Multi , Opt } ;
1465- use OptionStability :: Stable ;
1469+ use OptionStability :: { Stable , Unstable } ;
14661470
14671471 use self :: make_opt as opt;
14681472
1469- vec ! [
1473+ let mut options = vec ! [
14701474 opt( Stable , Flag , "h" , "help" , "Display this message" , "" ) ,
14711475 opt(
14721476 Stable ,
@@ -1553,21 +1557,11 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
15531557 opt( Stable , Multi , "C" , "codegen" , "Set a codegen option" , "OPT[=VALUE]" ) ,
15541558 opt( Stable , Flag , "V" , "version" , "Print version info and exit" , "" ) ,
15551559 opt( Stable , Flag , "v" , "verbose" , "Use verbose output" , "" ) ,
1556- ]
1557- }
1558-
1559- /// Returns all rustc command line options, including metadata for
1560- /// each option, such as whether the option is part of the stable
1561- /// long-term interface for rustc.
1562- pub fn rustc_optgroups ( ) -> Vec < RustcOptGroup > {
1563- use OptionKind :: { Multi , Opt } ;
1564- use OptionStability :: { Stable , Unstable } ;
1565-
1566- use self :: make_opt as opt;
1560+ ] ;
15671561
1568- let mut opts = rustc_short_optgroups ( ) ;
1569- // FIXME: none of these descriptions are actually used
1570- opts . extend ( vec ! [
1562+ // Options in this list are hidden from `rustc --help` by default, but are
1563+ // shown by `rustc --help -v`.
1564+ let verbose_only = [
15711565 opt (
15721566 Stable ,
15731567 Multi ,
@@ -1593,9 +1587,9 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
15931587 "" ,
15941588 "color" ,
15951589 "Configure coloring of output:
1596- auto = colorize, if output goes to a tty (default);
1597- always = always colorize output;
1598- never = never colorize output" ,
1590+ auto = colorize, if output goes to a tty (default);
1591+ always = always colorize output;
1592+ never = never colorize output" ,
15991593 "auto|always|never" ,
16001594 ) ,
16011595 opt (
@@ -1615,8 +1609,13 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
16151609 "FROM=TO" ,
16161610 ) ,
16171611 opt ( Unstable , Multi , "" , "env-set" , "Inject an environment variable" , "VAR=VALUE" ) ,
1618- ] ) ;
1619- opts
1612+ ] ;
1613+ options. extend ( verbose_only. into_iter ( ) . map ( |mut opt| {
1614+ opt. is_verbose_help_only = true ;
1615+ opt
1616+ } ) ) ;
1617+
1618+ options
16201619}
16211620
16221621pub fn get_cmd_lint_options (
0 commit comments