@@ -1650,7 +1650,7 @@ The default is {DEFAULT_EDITION} and the latest stable edition is {LATEST_STABLE
1650
1650
static PRINT_HELP : LazyLock < String > = LazyLock :: new ( || {
1651
1651
format ! (
1652
1652
"Compiler information to print on stdout (or to a file)\n \
1653
- INFO may be one of ({}) .",
1653
+ INFO may be one of <{}> .",
1654
1654
PRINT_KINDS . iter( ) . map( |( name, _) | format!( "{name}" ) ) . collect:: <Vec <_>>( ) . join( "|" )
1655
1655
)
1656
1656
} ) ;
@@ -1669,6 +1669,13 @@ static EMIT_HELP: LazyLock<String> = LazyLock::new(|| {
1669
1669
1670
1670
/// Returns all rustc command line options, including metadata for
1671
1671
/// 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
1672
1679
pub fn rustc_optgroups ( ) -> Vec < RustcOptGroup > {
1673
1680
use OptionKind :: { Flag , FlagMulti , Multi , Opt } ;
1674
1681
use OptionStability :: { Stable , Unstable } ;
@@ -1683,18 +1690,18 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
1683
1690
"" ,
1684
1691
"cfg" ,
1685
1692
"Configure the compilation environment.\n \
1686
- SPEC supports the syntax `NAME[=\" VALUE\" ]`.",
1687
- "SPEC" ,
1693
+ SPEC supports the syntax `< NAME> [=\" < VALUE> \" ]`.",
1694
+ "< SPEC> " ,
1688
1695
) ,
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> " ) ,
1690
1697
opt(
1691
1698
Stable ,
1692
1699
Multi ,
1693
1700
"L" ,
1694
1701
"" ,
1695
1702
"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> " ,
1698
1705
) ,
1699
1706
opt(
1700
1707
Stable ,
@@ -1703,46 +1710,46 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
1703
1710
"" ,
1704
1711
"Link the generated crate(s) to the specified native\n \
1705
1712
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 \
1707
1714
Optional comma separated MODIFIERS\n \
1708
- ( bundle|verbatim|whole-archive|as-needed) \n \
1715
+ < bundle|verbatim|whole-archive|as-needed> \n \
1709
1716
may be specified each with a prefix of either '+' to\n \
1710
1717
enable or '-' to disable.",
1711
- "[KIND[: MODIFIERS]=]NAME[: RENAME]" ,
1718
+ "[< KIND>[:< MODIFIERS> ]=]< NAME>[:< RENAME> ]" ,
1712
1719
) ,
1713
1720
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> " ) ,
1715
1722
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> ]" ) ,
1718
1725
opt( Stable , FlagMulti , "g" , "" , "Equivalent to -C debuginfo=2" , "" ) ,
1719
1726
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> " ) ,
1722
1729
opt(
1723
1730
Stable ,
1724
1731
Opt ,
1725
1732
"" ,
1726
1733
"explain" ,
1727
1734
"Provide a detailed explanation of an error message" ,
1728
- "OPT" ,
1735
+ "< OPT> " ,
1729
1736
) ,
1730
1737
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> " ) ,
1737
1744
opt(
1738
1745
Stable ,
1739
1746
Multi ,
1740
1747
"" ,
1741
1748
"cap-lints" ,
1742
1749
"Set the most restrictive lint level. More restrictive lints are capped at this level" ,
1743
- "LEVEL" ,
1750
+ "< LEVEL> " ,
1744
1751
) ,
1745
- opt( Stable , Multi , "C" , "codegen" , "Set a codegen option" , "OPT[= VALUE]" ) ,
1752
+ opt( Stable , Multi , "C" , "codegen" , "Set a codegen option" , "< OPT>[=< VALUE> ]" ) ,
1746
1753
opt( Stable , Flag , "V" , "version" , "Print version info and exit" , "" ) ,
1747
1754
opt( Stable , Flag , "v" , "verbose" , "Use verbose output" , "" ) ,
1748
1755
] ;
@@ -1756,47 +1763,47 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
1756
1763
"" ,
1757
1764
"extern" ,
1758
1765
"Specify where an external rust library is located" ,
1759
- "NAME[= PATH]" ,
1766
+ "< NAME>[=< PATH> ]" ,
1760
1767
) ,
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> " ) ,
1763
1770
opt (
1764
1771
Stable ,
1765
1772
Opt ,
1766
1773
"" ,
1767
1774
"error-format" ,
1768
1775
"How errors and other messages are produced" ,
1769
- "human|json|short" ,
1776
+ "< human|json|short> " ,
1770
1777
) ,
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> " ) ,
1772
1779
opt (
1773
1780
Stable ,
1774
1781
Opt ,
1775
1782
"" ,
1776
1783
"color" ,
1777
1784
"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> " ,
1782
1789
) ,
1783
1790
opt (
1784
1791
Stable ,
1785
1792
Opt ,
1786
1793
"" ,
1787
1794
"diagnostic-width" ,
1788
1795
"Inform rustc of the width of the output so that diagnostics can be truncated to fit" ,
1789
- "WIDTH" ,
1796
+ "< WIDTH> " ,
1790
1797
) ,
1791
1798
opt (
1792
1799
Stable ,
1793
1800
Multi ,
1794
1801
"" ,
1795
1802
"remap-path-prefix" ,
1796
1803
"Remap source names in all output (compiler messages and output files)" ,
1797
- "FROM=TO " ,
1804
+ "< FROM>=<TO> " ,
1798
1805
) ,
1799
- opt ( Unstable , Multi , "" , "env-set" , "Inject an environment variable" , "VAR= VALUE" ) ,
1806
+ opt ( Unstable , Multi , "" , "env-set" , "Inject an environment variable" , "< VAR>=< VALUE> " ) ,
1800
1807
] ;
1801
1808
options. extend ( verbose_only. into_iter ( ) . map ( |mut opt| {
1802
1809
opt. is_verbose_help_only = true ;
@@ -2796,7 +2803,7 @@ pub fn make_crate_type_option() -> RustcOptGroup {
2796
2803
"crate-type" ,
2797
2804
"Comma separated list of types of crates
2798
2805
for the compiler to emit" ,
2799
- "[ bin|lib|rlib|dylib|cdylib|staticlib|proc-macro] " ,
2806
+ "< bin|lib|rlib|dylib|cdylib|staticlib|proc-macro> " ,
2800
2807
)
2801
2808
}
2802
2809
0 commit comments