@@ -1413,6 +1413,10 @@ pub struct RustcOptGroup {
14131413 long_name : & ' static str ,
14141414 desc : & ' static str ,
14151415 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 ,
14161420}
14171421
14181422impl RustcOptGroup {
@@ -1452,6 +1456,7 @@ pub fn make_opt(
14521456 long_name,
14531457 desc,
14541458 value_hint,
1459+ is_verbose_help_only : false ,
14551460 }
14561461}
14571462
@@ -1462,16 +1467,15 @@ The default is {DEFAULT_EDITION} and the latest stable edition is {LATEST_STABLE
14621467 )
14631468} ) ;
14641469
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 > {
14691473 use OptionKind :: { Flag , FlagMulti , Multi , Opt } ;
1470- use OptionStability :: Stable ;
1474+ use OptionStability :: { Stable , Unstable } ;
14711475
14721476 use self :: make_opt as opt;
14731477
1474- vec ! [
1478+ let mut options = vec ! [
14751479 opt( Stable , Flag , "h" , "help" , "Display this message" , "" ) ,
14761480 opt(
14771481 Stable ,
@@ -1558,21 +1562,11 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
15581562 opt( Stable , Multi , "C" , "codegen" , "Set a codegen option" , "OPT[=VALUE]" ) ,
15591563 opt( Stable , Flag , "V" , "version" , "Print version info and exit" , "" ) ,
15601564 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+ ] ;
15721566
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 = [
15761570 opt (
15771571 Stable ,
15781572 Multi ,
@@ -1598,9 +1592,9 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
15981592 "" ,
15991593 "color" ,
16001594 "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" ,
16041598 "auto|always|never" ,
16051599 ) ,
16061600 opt (
@@ -1620,8 +1614,13 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
16201614 "FROM=TO" ,
16211615 ) ,
16221616 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
16251624}
16261625
16271626pub fn get_cmd_lint_options (
0 commit comments