Skip to content

Commit 088216f

Browse files
committed
Auto merge of rust-lang#44194 - QuietMisdreavus:hey-how-do-i-use-this-new-fangled-thing, r=aturon
expand on using rustup custom toolchains in CONTRIBUTING.md fixes rust-lang#42484 Should i include more notes about how to use a local build *without* rustup? It can kinda feel like a cop-out otherwise. Other means that come to mind are setting `$RUSTC` directly and fully installing it. cc @rust-lang/docs
2 parents a36d93d + 1615d35 commit 088216f

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

CONTRIBUTING.md

+28-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,34 @@ Some common invocations of `x.py` are:
232232
guidelines as of yet, but basic rules like 4 spaces for indentation and no
233233
more than 99 characters in a single line should be kept in mind when writing
234234
code.
235-
- `rustup toolchain link <name> build/<host-triple>/<stage>` - Use the custom compiler build via [rustup](https://github.com/rust-lang-nursery/rustup.rs#working-with-custom-toolchains-and-local-builds).
235+
236+
### Using your local build
237+
238+
If you use Rustup to manage your rust install, it has a feature called ["custom
239+
toolchains"][toolchain-link] that you can use to access your newly-built compiler
240+
without having to install it to your system or user PATH. If you've run `python
241+
x.py build`, then you can add your custom rustc to a new toolchain like this:
242+
243+
[toolchain-link]: https://github.com/rust-lang-nursery/rustup.rs#working-with-custom-toolchains-and-local-builds
244+
245+
```
246+
rustup toolchain link <name> build/<host-triple>/stage2
247+
```
248+
249+
Where `<host-triple>` is the build triple for the host (the triple of your
250+
computer, by default), and `<name>` is the name for your custom toolchain. (If you
251+
added `--stage 1` to your build command, the compiler will be in the `stage1`
252+
folder instead.) You'll only need to do this once - it will automatically point
253+
to the latest build you've done.
254+
255+
Once this is set up, you can use your custom toolchain just like any other. For
256+
example, if you've named your toolchain `local`, running `cargo +local build` will
257+
compile a project with your custom rustc, setting `rustup override set local` will
258+
override the toolchain for your current directory, and `cargo +local doc` will use
259+
your custom rustc and rustdoc to generate docs. (If you do this with a `--stage 1`
260+
build, you'll need to build rustdoc specially, since it's not normally built in
261+
stage 1. `python x.py build --stage 1 src/libstd src/tools/rustdoc` will build
262+
rustdoc and libstd, which will allow rustdoc to be run with that toolchain.)
236263

237264
## Pull Requests
238265

0 commit comments

Comments
 (0)