|
1 | 1 | # Components
|
| 2 | + |
| 3 | +Each [toolchain] has several "components", some of which are required (like |
| 4 | +`rustc`) and some that are optional (like [`clippy`][clippy]). The `rustup |
| 5 | +component` command is used to manage the installed components. For example, |
| 6 | +run `rustup component list` to see a list of available and installed |
| 7 | +components. |
| 8 | + |
| 9 | +Components can be added when installing a toolchain with the `--component` |
| 10 | +flag. For example: |
| 11 | + |
| 12 | +```console |
| 13 | +rustup toolchain install nightly --component rust-docs |
| 14 | +``` |
| 15 | + |
| 16 | +Components can be added to an already-installed toolchain with the `rustup |
| 17 | +component` command: |
| 18 | + |
| 19 | +```console |
| 20 | +rustup component add rust-docs |
| 21 | +``` |
| 22 | + |
| 23 | +To make it easier to choose which components are installed, `rustup` has the |
| 24 | +concept of "profiles" which provide named groupings of different components. |
| 25 | +See the [Profiles] chapter for more detail. |
| 26 | + |
| 27 | +Most components have a target-triple suffix, such as |
| 28 | +`rustc-x86_64-apple-darwin`, to signify the platform the component is for. |
| 29 | + |
| 30 | +The set of available components may vary with different releases and |
| 31 | +toolchains. The following is an overview of the different components: |
| 32 | + |
| 33 | +* `rustc` — The Rust compiler. |
| 34 | +* `cargo` — [Cargo] is a package manager and build tool. |
| 35 | +* `rustfmt` — [Rustfmt] is a tool for automatically formatting code. |
| 36 | +* `rust-std` — This is the Rust [standard library]. There is a separate |
| 37 | + `rust-std` component for each target that `rustc` supports, such as |
| 38 | + `rust-std-x86_64-pc-windows-msvc`. See the [Cross-compilation] chapter for |
| 39 | + more detail. |
| 40 | +* `rust-docs` — This is a local copy of the [Rust documentation]. Use the |
| 41 | + `rustup doc` command to open the documentation in a web browser. Run `rustup |
| 42 | + doc --help` for more options. |
| 43 | +* `rls` — [RLS] is a language server that provides support for editors and |
| 44 | + IDEs. |
| 45 | +* `rust-analyzer-preview` — [Rust anaylzer] is a new language server intended |
| 46 | + to eventually replace [RLS]. This is a preview release as it is still in the |
| 47 | + experimental phase. |
| 48 | +* `clippy` — [Clippy] is a lint tool that provides extra checks for common |
| 49 | + mistakes and stylistic choices. |
| 50 | +* `miri` — [Miri] is an experimental Rust interpreter, which can be used for |
| 51 | + checking for undefined-behavior. |
| 52 | +* `rust-src` — This is a local copy of the source code of the Rust standard |
| 53 | + library. This can be used by some tools, such as [RLS], to provide |
| 54 | + auto-completion for functions within the standard library; [Miri] which is a |
| 55 | + Rust interpreter; and Cargo's experimental [build-std] feature, which allows |
| 56 | + you to rebuild the standard library locally. |
| 57 | +* `rust-analysis` — Metadata about the standard library, used by tools like |
| 58 | + [RLS]. |
| 59 | +* `rust-mingw` — This contains a linker and platform libraries for building on |
| 60 | + the `x86_64-pc-windows-gnu` platform. |
| 61 | +* `llvm-tools-preview` — This is an experimental component which contains a |
| 62 | + collection of [LLVM] tools. |
| 63 | +* `rustc-dev` — This component contains the compiler as a library. Most users |
| 64 | + will not need this; it is only needed for development *of* tools that link |
| 65 | + to the compiler, such as making modifications to [Clippy]. |
| 66 | + |
| 67 | +## Component availability |
| 68 | + |
| 69 | +Not all components are available for all toolchains. Especially on the nightly |
| 70 | +channel, some components may not be included if they are in a broken state. |
| 71 | +The current status of all the components may be found on the [rustup |
| 72 | +components history] page. See the [Nightly availability] section for more |
| 73 | +details. |
| 74 | + |
| 75 | +[toolchain]: toolchains.md |
| 76 | +[standard library]: https://doc.rust-lang.org/std/ |
| 77 | +[rust documentation]: https://doc.rust-lang.org/ |
| 78 | +[cross-compilation]: ../cross-compilation.md |
| 79 | +[build-std]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-std |
| 80 | +[miri]: https://github.com/rust-lang/miri/ |
| 81 | +[RLS]: https://github.com/rust-lang/rls |
| 82 | +[cargo]: https://doc.rust-lang.org/cargo/ |
| 83 | +[clippy]: https://github.com/rust-lang/rust-clippy |
| 84 | +[LLVM]: https://llvm.org/ |
| 85 | +[rustfmt]: https://github.com/rust-lang/rustfmt |
| 86 | +[rustup components history]: https://rust-lang.github.io/rustup-components-history/ |
| 87 | +[profiles]: profiles.md |
| 88 | +[rust anaylzer]: https://rust-analyzer.github.io/ |
| 89 | +[nightly availability]: channels.md#nightly-availability |
0 commit comments