Commit eb225e3
authored
Rollup merge of rust-lang#140152 - xizheyin:issue-140102, r=jieyouxu
Unify the format of rustc cli flags
As mentioned in rust-lang#140102, I unified the format of rustc CLI flags.
I use the following rules:
1. `<param>`: Indicates a required parameter
2. `[param]`: Indicates an optional parameter
3. `|`: Indicates a mutually exclusive option
4. `*`: a list element with description
Current output:
```bash
Usage: rustc [OPTIONS] INPUT
Options:
-h, --help Display this message
--cfg <SPEC> Configure the compilation environment.
SPEC supports the syntax `<NAME>[="<VALUE>"]`.
--check-cfg <SPEC>
Provide list of expected cfgs for checking
-L [<KIND>=]<PATH> Add a directory to the library search path. The
optional KIND can be one of
<dependency|crate|native|framework|all> (default:
all).
-l [<KIND>[:<MODIFIERS>]=]<NAME>[:<RENAME>]
Link the generated crate(s) to the specified native
library NAME. The optional KIND can be one of
<static|framework|dylib> (default: dylib).
Optional comma separated MODIFIERS
<bundle|verbatim|whole-archive|as-needed>
may be specified each with a prefix of either '+' to
enable or '-' to disable.
--crate-type <bin|lib|rlib|dylib|cdylib|staticlib|proc-macro>
Comma separated list of types of crates
for the compiler to emit
--crate-name <NAME>
Specify the name of the crate being built
--edition <2015|2018|2021|2024|future>
Specify which edition of the compiler to use when
compiling code. The default is 2015 and the latest
stable edition is 2024.
--emit <TYPE>[=<FILE>]
Comma separated list of types of output for the
compiler to emit.
Each TYPE has the default FILE name:
* asm - CRATE_NAME.s
* llvm-bc - CRATE_NAME.bc
* dep-info - CRATE_NAME.d
* link - (platform and crate-type dependent)
* llvm-ir - CRATE_NAME.ll
* metadata - libCRATE_NAME.rmeta
* mir - CRATE_NAME.mir
* obj - CRATE_NAME.o
* thin-link-bitcode - CRATE_NAME.indexing.o
--print <INFO>[=<FILE>]
Compiler information to print on stdout (or to a file)
INFO may be one of
<all-target-specs-json|calling-conventions|cfg|check-cfg|code-models|crate-name|crate-root-lint-levels|deployment-target|file-names|host-tuple|link-args|native-static-libs|relocation-models|split-debuginfo|stack-protector-strategies|supported-crate-types|sysroot|target-cpus|target-features|target-libdir|target-list|target-spec-json|tls-models>.
-g Equivalent to -C debuginfo=2
-O Equivalent to -C opt-level=3
-o <FILENAME> Write output to FILENAME
--out-dir <DIR> Write output to compiler-chosen filename in DIR
--explain <OPT> Provide a detailed explanation of an error message
--test Build a test harness
--target <TARGET>
Target triple for which the code is compiled
-A, --allow <LINT> Set lint allowed
-W, --warn <LINT> Set lint warnings
--force-warn <LINT>
Set lint force-warn
-D, --deny <LINT> Set lint denied
-F, --forbid <LINT> Set lint forbidden
--cap-lints <LEVEL>
Set the most restrictive lint level. More restrictive
lints are capped at this level
-C, --codegen <OPT>[=<VALUE>]
Set a codegen option
-V, --version Print version info and exit
-v, --verbose Use verbose output
Additional help:
-C help Print codegen options
-W help Print 'lint' options and default settings
-Z help Print unstable compiler options
--help -v Print the full set of options rustc accepts
```File tree
9 files changed
+130
-115
lines changed- compiler
- rustc_session/src
- rustc_span/src
- tests
- run-make
- rustc-help
- rustdoc-default-output
- ui
- compiletest-self-test
- invalid-compile-flags
9 files changed
+130
-115
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1650 | 1650 | | |
1651 | 1651 | | |
1652 | 1652 | | |
1653 | | - | |
| 1653 | + | |
1654 | 1654 | | |
1655 | 1655 | | |
1656 | 1656 | | |
| |||
1669 | 1669 | | |
1670 | 1670 | | |
1671 | 1671 | | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
1672 | 1679 | | |
1673 | 1680 | | |
1674 | 1681 | | |
| |||
1683 | 1690 | | |
1684 | 1691 | | |
1685 | 1692 | | |
1686 | | - | |
1687 | | - | |
| 1693 | + | |
| 1694 | + | |
1688 | 1695 | | |
1689 | | - | |
| 1696 | + | |
1690 | 1697 | | |
1691 | 1698 | | |
1692 | 1699 | | |
1693 | 1700 | | |
1694 | 1701 | | |
1695 | 1702 | | |
1696 | | - | |
1697 | | - | |
| 1703 | + | |
| 1704 | + | |
1698 | 1705 | | |
1699 | 1706 | | |
1700 | 1707 | | |
| |||
1703 | 1710 | | |
1704 | 1711 | | |
1705 | 1712 | | |
1706 | | - | |
| 1713 | + | |
1707 | 1714 | | |
1708 | | - | |
| 1715 | + | |
1709 | 1716 | | |
1710 | 1717 | | |
1711 | | - | |
| 1718 | + | |
1712 | 1719 | | |
1713 | 1720 | | |
1714 | | - | |
| 1721 | + | |
1715 | 1722 | | |
1716 | | - | |
1717 | | - | |
| 1723 | + | |
| 1724 | + | |
1718 | 1725 | | |
1719 | 1726 | | |
1720 | | - | |
1721 | | - | |
| 1727 | + | |
| 1728 | + | |
1722 | 1729 | | |
1723 | 1730 | | |
1724 | 1731 | | |
1725 | 1732 | | |
1726 | 1733 | | |
1727 | 1734 | | |
1728 | | - | |
| 1735 | + | |
1729 | 1736 | | |
1730 | 1737 | | |
1731 | | - | |
1732 | | - | |
1733 | | - | |
1734 | | - | |
1735 | | - | |
1736 | | - | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
1737 | 1744 | | |
1738 | 1745 | | |
1739 | 1746 | | |
1740 | 1747 | | |
1741 | 1748 | | |
1742 | 1749 | | |
1743 | | - | |
| 1750 | + | |
1744 | 1751 | | |
1745 | | - | |
| 1752 | + | |
1746 | 1753 | | |
1747 | 1754 | | |
1748 | 1755 | | |
| |||
1756 | 1763 | | |
1757 | 1764 | | |
1758 | 1765 | | |
1759 | | - | |
| 1766 | + | |
1760 | 1767 | | |
1761 | | - | |
1762 | | - | |
| 1768 | + | |
| 1769 | + | |
1763 | 1770 | | |
1764 | 1771 | | |
1765 | 1772 | | |
1766 | 1773 | | |
1767 | 1774 | | |
1768 | 1775 | | |
1769 | | - | |
| 1776 | + | |
1770 | 1777 | | |
1771 | | - | |
| 1778 | + | |
1772 | 1779 | | |
1773 | 1780 | | |
1774 | 1781 | | |
1775 | 1782 | | |
1776 | 1783 | | |
1777 | 1784 | | |
1778 | | - | |
1779 | | - | |
1780 | | - | |
1781 | | - | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
1782 | 1789 | | |
1783 | 1790 | | |
1784 | 1791 | | |
1785 | 1792 | | |
1786 | 1793 | | |
1787 | 1794 | | |
1788 | 1795 | | |
1789 | | - | |
| 1796 | + | |
1790 | 1797 | | |
1791 | 1798 | | |
1792 | 1799 | | |
1793 | 1800 | | |
1794 | 1801 | | |
1795 | 1802 | | |
1796 | 1803 | | |
1797 | | - | |
| 1804 | + | |
1798 | 1805 | | |
1799 | | - | |
| 1806 | + | |
1800 | 1807 | | |
1801 | 1808 | | |
1802 | 1809 | | |
| |||
2796 | 2803 | | |
2797 | 2804 | | |
2798 | 2805 | | |
2799 | | - | |
| 2806 | + | |
2800 | 2807 | | |
2801 | 2808 | | |
2802 | 2809 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | | - | |
8 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
9 | 10 | | |
10 | | - | |
11 | | - | |
| 11 | + | |
| 12 | + | |
12 | 13 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | | - | |
| 16 | + | |
16 | 17 | | |
17 | | - | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | | - | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | | - | |
| 24 | + | |
24 | 25 | | |
25 | | - | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | | - | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
42 | | - | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | | - | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | | - | |
49 | | - | |
50 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
51 | 52 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
56 | 58 | | |
57 | | - | |
58 | | - | |
59 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
60 | 62 | | |
61 | 63 | | |
62 | | - | |
| 64 | + | |
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
66 | | - | |
| 68 | + | |
67 | 69 | | |
68 | | - | |
69 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
70 | 73 | | |
71 | | - | |
72 | | - | |
| 74 | + | |
| 75 | + | |
73 | 76 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
78 | 81 | | |
79 | 82 | | |
80 | | - | |
| 83 | + | |
81 | 84 | | |
82 | 85 | | |
83 | 86 | | |
| |||
0 commit comments