@@ -1650,7 +1650,7 @@ The default is {DEFAULT_EDITION} and the latest stable edition is {LATEST_STABLE
16501650static PRINT_HELP : LazyLock < String > = LazyLock :: new ( || {
16511651 format ! (
16521652 "Compiler information to print on stdout (or to a file)\n \
1653- INFO may be one of ({}) .",
1653+ INFO may be one of <{}> .",
16541654 PRINT_KINDS . iter( ) . map( |( name, _) | format!( "{name}" ) ) . collect:: <Vec <_>>( ) . join( "|" )
16551655 )
16561656} ) ;
@@ -1669,6 +1669,13 @@ static EMIT_HELP: LazyLock<String> = LazyLock::new(|| {
16691669
16701670/// Returns all rustc command line options, including metadata for
16711671/// each option, such as whether the option is stable.
1672+ ///
1673+ /// # Option style guidelines
1674+ ///
1675+ /// - `<param>`: Indicates a required parameter
1676+ /// - `[param]`: Indicates an optional parameter
1677+ /// - `|`: Indicates a mutually exclusive option
1678+ /// - `*`: a list element with description
16721679pub fn rustc_optgroups ( ) -> Vec < RustcOptGroup > {
16731680 use OptionKind :: { Flag , FlagMulti , Multi , Opt } ;
16741681 use OptionStability :: { Stable , Unstable } ;
@@ -1683,18 +1690,18 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
16831690 "" ,
16841691 "cfg" ,
16851692 "Configure the compilation environment.\n \
1686- SPEC supports the syntax `NAME[=\" VALUE\" ]`.",
1687- "SPEC" ,
1693+ SPEC supports the syntax `< NAME> [=\" < VALUE> \" ]`.",
1694+ "< SPEC> " ,
16881695 ) ,
1689- opt( Stable , Multi , "" , "check-cfg" , "Provide list of expected cfgs for checking" , "SPEC" ) ,
1696+ opt( Stable , Multi , "" , "check-cfg" , "Provide list of expected cfgs for checking" , "< SPEC> " ) ,
16901697 opt(
16911698 Stable ,
16921699 Multi ,
16931700 "L" ,
16941701 "" ,
16951702 "Add a directory to the library search path. \
1696- The optional KIND can be one of dependency, crate, native, framework, or all (the default).",
1697- "[KIND=] PATH" ,
1703+ The optional KIND can be one of < dependency| crate| native| framework| all> ( default: all ).",
1704+ "[< KIND>=]< PATH> " ,
16981705 ) ,
16991706 opt(
17001707 Stable ,
@@ -1703,46 +1710,46 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
17031710 "" ,
17041711 "Link the generated crate(s) to the specified native\n \
17051712 library NAME. The optional KIND can be one of\n \
1706- static, framework, or dylib (the default).\n \
1713+ < static| framework| dylib> ( default: dylib ).\n \
17071714 Optional comma separated MODIFIERS\n \
1708- ( bundle|verbatim|whole-archive|as-needed) \n \
1715+ < bundle|verbatim|whole-archive|as-needed> \n \
17091716 may be specified each with a prefix of either '+' to\n \
17101717 enable or '-' to disable.",
1711- "[KIND[: MODIFIERS]=]NAME[: RENAME]" ,
1718+ "[< KIND>[:< MODIFIERS> ]=]< NAME>[:< RENAME> ]" ,
17121719 ) ,
17131720 make_crate_type_option( ) ,
1714- opt( Stable , Opt , "" , "crate-name" , "Specify the name of the crate being built" , "NAME" ) ,
1721+ opt( Stable , Opt , "" , "crate-name" , "Specify the name of the crate being built" , "< NAME> " ) ,
17151722 opt( Stable , Opt , "" , "edition" , & EDITION_STRING , EDITION_NAME_LIST ) ,
1716- opt( Stable , Multi , "" , "emit" , & EMIT_HELP , "TYPE[= FILE]" ) ,
1717- opt( Stable , Multi , "" , "print" , & PRINT_HELP , "INFO[= FILE]" ) ,
1723+ opt( Stable , Multi , "" , "emit" , & EMIT_HELP , "< TYPE>[=< FILE> ]" ) ,
1724+ opt( Stable , Multi , "" , "print" , & PRINT_HELP , "< INFO>[=< FILE> ]" ) ,
17181725 opt( Stable , FlagMulti , "g" , "" , "Equivalent to -C debuginfo=2" , "" ) ,
17191726 opt( Stable , FlagMulti , "O" , "" , "Equivalent to -C opt-level=3" , "" ) ,
1720- opt( Stable , Opt , "o" , "" , "Write output to <filename> " , "FILENAME" ) ,
1721- opt( Stable , Opt , "" , "out-dir" , "Write output to compiler-chosen filename in <dir> " , "DIR" ) ,
1727+ opt( Stable , Opt , "o" , "" , "Write output to FILENAME " , "< FILENAME> " ) ,
1728+ opt( Stable , Opt , "" , "out-dir" , "Write output to compiler-chosen filename in DIR " , "< DIR> " ) ,
17221729 opt(
17231730 Stable ,
17241731 Opt ,
17251732 "" ,
17261733 "explain" ,
17271734 "Provide a detailed explanation of an error message" ,
1728- "OPT" ,
1735+ "< OPT> " ,
17291736 ) ,
17301737 opt( Stable , Flag , "" , "test" , "Build a test harness" , "" ) ,
1731- opt( Stable , Opt , "" , "target" , "Target triple for which the code is compiled" , "TARGET" ) ,
1732- opt( Stable , Multi , "A" , "allow" , "Set lint allowed" , "LINT" ) ,
1733- opt( Stable , Multi , "W" , "warn" , "Set lint warnings" , "LINT" ) ,
1734- opt( Stable , Multi , "" , "force-warn" , "Set lint force-warn" , "LINT" ) ,
1735- opt( Stable , Multi , "D" , "deny" , "Set lint denied" , "LINT" ) ,
1736- opt( Stable , Multi , "F" , "forbid" , "Set lint forbidden" , "LINT" ) ,
1738+ opt( Stable , Opt , "" , "target" , "Target triple for which the code is compiled" , "< TARGET> " ) ,
1739+ opt( Stable , Multi , "A" , "allow" , "Set lint allowed" , "< LINT> " ) ,
1740+ opt( Stable , Multi , "W" , "warn" , "Set lint warnings" , "< LINT> " ) ,
1741+ opt( Stable , Multi , "" , "force-warn" , "Set lint force-warn" , "< LINT> " ) ,
1742+ opt( Stable , Multi , "D" , "deny" , "Set lint denied" , "< LINT> " ) ,
1743+ opt( Stable , Multi , "F" , "forbid" , "Set lint forbidden" , "< LINT> " ) ,
17371744 opt(
17381745 Stable ,
17391746 Multi ,
17401747 "" ,
17411748 "cap-lints" ,
17421749 "Set the most restrictive lint level. More restrictive lints are capped at this level" ,
1743- "LEVEL" ,
1750+ "< LEVEL> " ,
17441751 ) ,
1745- opt( Stable , Multi , "C" , "codegen" , "Set a codegen option" , "OPT[= VALUE]" ) ,
1752+ opt( Stable , Multi , "C" , "codegen" , "Set a codegen option" , "< OPT>[=< VALUE> ]" ) ,
17461753 opt( Stable , Flag , "V" , "version" , "Print version info and exit" , "" ) ,
17471754 opt( Stable , Flag , "v" , "verbose" , "Use verbose output" , "" ) ,
17481755 ] ;
@@ -1756,47 +1763,47 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
17561763 "" ,
17571764 "extern" ,
17581765 "Specify where an external rust library is located" ,
1759- "NAME[= PATH]" ,
1766+ "< NAME>[=< PATH> ]" ,
17601767 ) ,
1761- opt ( Stable , Opt , "" , "sysroot" , "Override the system root" , "PATH" ) ,
1762- opt ( Unstable , Multi , "Z" , "" , "Set unstable / perma-unstable options" , "FLAG" ) ,
1768+ opt ( Stable , Opt , "" , "sysroot" , "Override the system root" , "< PATH> " ) ,
1769+ opt ( Unstable , Multi , "Z" , "" , "Set unstable / perma-unstable options" , "< FLAG> " ) ,
17631770 opt (
17641771 Stable ,
17651772 Opt ,
17661773 "" ,
17671774 "error-format" ,
17681775 "How errors and other messages are produced" ,
1769- "human|json|short" ,
1776+ "< human|json|short> " ,
17701777 ) ,
1771- opt ( Stable , Multi , "" , "json" , "Configure the JSON output of the compiler" , "CONFIG" ) ,
1778+ opt ( Stable , Multi , "" , "json" , "Configure the JSON output of the compiler" , "< CONFIG> " ) ,
17721779 opt (
17731780 Stable ,
17741781 Opt ,
17751782 "" ,
17761783 "color" ,
17771784 "Configure coloring of output:
1778- auto = colorize, if output goes to a tty (default);
1779- always = always colorize output;
1780- never = never colorize output" ,
1781- "auto|always|never" ,
1785+ * auto = colorize, if output goes to a tty (default);
1786+ * always = always colorize output;
1787+ * never = never colorize output" ,
1788+ "< auto|always|never> " ,
17821789 ) ,
17831790 opt (
17841791 Stable ,
17851792 Opt ,
17861793 "" ,
17871794 "diagnostic-width" ,
17881795 "Inform rustc of the width of the output so that diagnostics can be truncated to fit" ,
1789- "WIDTH" ,
1796+ "< WIDTH> " ,
17901797 ) ,
17911798 opt (
17921799 Stable ,
17931800 Multi ,
17941801 "" ,
17951802 "remap-path-prefix" ,
17961803 "Remap source names in all output (compiler messages and output files)" ,
1797- "FROM=TO " ,
1804+ "< FROM>=<TO> " ,
17981805 ) ,
1799- opt ( Unstable , Multi , "" , "env-set" , "Inject an environment variable" , "VAR= VALUE" ) ,
1806+ opt ( Unstable , Multi , "" , "env-set" , "Inject an environment variable" , "< VAR>=< VALUE> " ) ,
18001807 ] ;
18011808 options. extend ( verbose_only. into_iter ( ) . map ( |mut opt| {
18021809 opt. is_verbose_help_only = true ;
@@ -2796,7 +2803,7 @@ pub fn make_crate_type_option() -> RustcOptGroup {
27962803 "crate-type" ,
27972804 "Comma separated list of types of crates
27982805 for the compiler to emit" ,
2799- "[ bin|lib|rlib|dylib|cdylib|staticlib|proc-macro] " ,
2806+ "< bin|lib|rlib|dylib|cdylib|staticlib|proc-macro> " ,
28002807 )
28012808}
28022809
0 commit comments