@@ -17,8 +17,11 @@ And it runs on all platforms Rust supports, including Windows.
1717* [ How rustup works] ( #how-rustup-works )
1818* [ Keeping Rust up to date] ( #keeping-rust-up-to-date )
1919* [ Working with nightly Rust] ( #working-with-nightly-rust )
20- * [ Directory overrides] ( #directory-overrides )
2120* [ Toolchain specification] ( #toolchain-specification )
21+ * [ Toolchain override shorthand] ( #toolchain-override-shorthand )
22+ * [ Directory overrides] ( #directory-overrides )
23+ * [ The toolchain file] ( #the-toolchain-file )
24+ * [ Override precedence] ( #override-precedence )
2225* [ Cross-compilation] ( #cross-compilation )
2326* [ Working with Rust on Windows] ( #working-with-rust-on-windows )
2427* [ Working with custom toolchains] ( #working-with-custom-toolchains-and-local-builds )
@@ -231,29 +234,6 @@ info: downloading self-updates
231234
232235```
233236
234- ## Directory overrides
235-
236- Directories can be assigned their own Rust toolchain with
237- ` rustup override ` . When a directory has an override then
238- any time ` rustc ` or ` cargo ` is run inside that directory,
239- or one of its child directories, the override toolchain
240- will be invoked.
241-
242- To pin to a specific nightly:
243-
244- ```
245- rustup override set nightly-2014-12-18
246- ```
247-
248- Or a specific stable release:
249-
250- ```
251- rustup override set 1.0.0
252- ```
253-
254- To see the active toolchain use ` rustup show ` . To remove the override
255- and use the default toolchain again, ` rustup override unset ` .
256-
257237## Toolchain specification
258238
259239Many ` rustup ` commands deal with * toolchains* , a single installation
@@ -299,6 +279,83 @@ Toolchain names that don't name a channel instead can be used to name
299279[ MSVC-based toolchain ] : https://www.rust-lang.org/downloads.html#win-foot
300280[ custom toolchains ] : #working-with-custom-toolchains-and-local-builds
301281
282+ ## Toolchain override shorthand
283+
284+ The ` rustup ` toolchain proxies can be instructed directly to use a
285+ specific toolchain, a convience for developers who often test
286+ different toolchains. If the first argument to ` cargo ` , ` rustc ` or
287+ other tools in the toolchain begins with ` + ` , it will be interpreted
288+ as a rustup toolchain name, and that toolchain will be preferred,
289+ as in
290+
291+ ```
292+ cargo +beta test
293+ ```
294+
295+ ## Directory overrides
296+
297+ Directories can be assigned their own Rust toolchain with `rustup
298+ override` . When a directory has an override then any time ` rustc` or
299+ ` cargo ` is run inside that directory, or one of its child directories,
300+ the override toolchain will be invoked.
301+
302+ To use to a specific nightly for a directory:
303+
304+ ```
305+ rustup override set nightly-2014-12-18
306+ ```
307+
308+ Or a specific stable release:
309+
310+ ```
311+ rustup override set 1.0.0
312+ ```
313+
314+ To see the active toolchain use ` rustup show ` . To remove the override
315+ and use the default toolchain again, ` rustup override unset ` .
316+
317+ ## The toolchain file
318+
319+ ` rustup ` directory overrides are a local configuration, stored in
320+ ` $RUSTUP_HOME ` . Some projects though find themselves 'pinned' to a
321+ specific release of Rust and want this information reflected in their
322+ source repository. This is most often the case for nightly-only
323+ software that pins to a revision from the release archives.
324+
325+ In these cases the toolchain can be named in the project's directory
326+ in a file called ` rust-toolchain ` , the content of which is the name of
327+ a single ` rustup ` toolchain, and which is suitable to check in to
328+ source control.
329+
330+ The toolchains named in this file have a more restricted form than
331+ rustup toolchains generally, and may only contain the names of the
332+ three release channels, 'stable', 'beta', 'nightly', Rust version
333+ numbers, like '1.0.0', and optionally an archive date, like
334+ 'nightly-2017-01-01'. They may not name custom toolchains, nor
335+ host-specific toolchains.
336+
337+ ## Override precedence
338+
339+ There are several ways to specify which toolchain ` rustup ` should
340+ execute:
341+
342+ * An explicit toolchain, e.g. ` cargo +beta ` ,
343+ * The ` RUSTUP_TOOLCHAIN ` environment variable,
344+ * A directory override, ala ` rustup override set beta ` ,
345+ * The ` rust-toolchain ` file,
346+ * The default toolchain,
347+
348+ and they are prefered by rustup in that order, with the explicit
349+ toolchain having highest precedence, and the default toolchain having
350+ the lowest. There is one exception though: directory overrides and the
351+ ` rust-toolchain ` file are also preferred by their proximity to the
352+ current directory. That is, these two override methods are discovered
353+ by walking up the directory tree toward the filesystem root, and a
354+ ` rust-toolchain ` file that is closer to the current directory will be
355+ prefered over a directory override that is further away.
356+
357+ To verify which toolchain is active use ` rustup show ` .
358+
302359## Cross-compilation
303360
304361Rust [ supports a great number of platforms] [ p ] . For many of these
0 commit comments