Skip to content

Commit 90beb56

Browse files
committed
Update override docs for rust-toolchain.toml files
1 parent 48782f8 commit 90beb56

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

doc/src/overrides.md

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ and override which toolchain is used:
88
+beta`.
99
2. The `RUSTUP_TOOLCHAIN` environment variable.
1010
3. A [directory override], set with the `rustup override` command.
11-
4. The [`rust-toolchain`] file.
11+
4. The [`rust-toolchain.toml`] file.
1212
5. The [default toolchain].
1313

1414
The toolchain is chosen in the order listed above, using the first one that is
1515
specified. There is one exception though: directory overrides and the
16-
`rust-toolchain` file are also preferred by their proximity to the current
16+
`rust-toolchain.toml` file are also preferred by their proximity to the current
1717
directory. That is, these two override methods are discovered by walking up
18-
the directory tree toward the filesystem root, and a `rust-toolchain` file
18+
the directory tree toward the filesystem root, and a `rust-toolchain.toml` file
1919
that is closer to the current directory will be preferred over a directory
2020
override that is further away.
2121

@@ -24,7 +24,7 @@ To verify which toolchain is active use `rustup show`.
2424
[toolchain]: concepts/toolchains.md
2525
[toolchain override shorthand]: #toolchain-override-shorthand
2626
[directory override]: #directory-overrides
27-
[`rust-toolchain`]: #the-toolchain-file
27+
[`rust-toolchain.toml`]: #the-toolchain-file
2828
[default toolchain]: #default-toolchain
2929

3030
## Toolchain override shorthand
@@ -74,8 +74,11 @@ case for nightly-only software that pins to a revision from the release
7474
archives.
7575

7676
In these cases the toolchain can be named in the project's directory in a file
77-
called `rust-toolchain`, the content of which is either the name of a single
78-
`rustup` toolchain, or a TOML file with the following layout:
77+
called `rust-toolchain.toml` or `rust-toolchain`. If both files are present in
78+
a directory, the latter is used for backwards compatibility. The files use the
79+
[TOML] format and have the following layout:
80+
81+
[TOML]: https://toml.io/
7982

8083
``` toml
8184
[toolchain]
@@ -85,14 +88,19 @@ targets = [ "wasm32-unknown-unknown", "thumbv2-none-eabi" ]
8588
profile = "minimal"
8689
```
8790

88-
If the TOML format is used, the `[toolchain]` section is mandatory, and at
89-
least one property must be specified.
91+
The `[toolchain]` section is mandatory, and at least one property must be
92+
specified.
93+
94+
For backwards compatibility, `rust-toolchain` files also support a legacy
95+
format that only contains a toolchain name without any TOML encoding, e.g.
96+
just `nightly-2021-01-21`. The file has to be encoded in US-ASCII this case
97+
(if you are on Windows, check the encoding and that it does not starts with a
98+
BOM). The legacy format is not available in `rust-toolchain.toml` files.
9099

91-
The `rust-toolchain` file is suitable to check in to source control. This file
92-
has to be encoded in US-ASCII (if you are on Windows, check the encoding and
93-
that it does not starts with a BOM).
100+
The `rust-toolchain.toml`/`rust-toolchain` files are suitable to check in to
101+
source control.
94102

95-
The toolchains named in this file have a more restricted form than `rustup`
103+
The toolchains named in these files have a more restricted form than `rustup`
96104
toolchains generally, and may only contain the names of the three release
97105
channels, 'stable', 'beta', 'nightly', Rust version numbers, like '1.0.0', and
98106
optionally an archive date, like 'nightly-2017-01-01'. They may not name

0 commit comments

Comments
 (0)