Skip to content

Commit b5f98c8

Browse files
authored
Merge pull request #2438 from ebroto/rust_toolchain_toml
Accept TOML format in rust-toolchain
2 parents 0db31cd + c2db7da commit b5f98c8

File tree

5 files changed

+521
-38
lines changed

5 files changed

+521
-38
lines changed

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,21 @@ source repository. This is most often the case for nightly-only
404404
software that pins to a revision from the release archives.
405405

406406
In these cases the toolchain can be named in the project's directory
407-
in a file called `rust-toolchain`, the content of which is the name of
408-
a single `rustup` toolchain, and which is suitable to check in to
409-
source control. This file has to be encoded in US-ASCII (if you are on
407+
in a file called `rust-toolchain`, the content of which is either the name of
408+
a single `rustup` toolchain, or a TOML file with the following layout:
409+
410+
``` toml
411+
[toolchain]
412+
channel = "nightly-2020-07-10"
413+
components = [ "rustfmt", "rustc-dev" ]
414+
targets = [ "wasm32-unknown-unknown", "thumbv2-none-eabi" ]
415+
```
416+
417+
If the TOML format is used, the `[toolchain]` section is mandatory,
418+
and at least one property must be specified.
419+
420+
The `rust-toolchain` file is suitable to check in to source control.
421+
This file has to be encoded in US-ASCII (if you are on
410422
Windows, check the encoding and that it does not starts with a BOM).
411423

412424
The toolchains named in this file have a more restricted form than

src/cli/common.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,8 @@ pub fn list_toolchains(cfg: &Cfg, verbose: bool) -> Result<utils::ExitCode> {
480480
String::new()
481481
};
482482
let cwd = utils::current_dir()?;
483-
let ovr_toolchain_name = if let Ok(Some((ovr_toolchain, _reason))) = cfg.find_override(&cwd)
484-
{
485-
ovr_toolchain.name().to_string()
483+
let ovr_toolchain_name = if let Ok(Some((toolchain, _reason))) = cfg.find_override(&cwd) {
484+
toolchain.name().to_string()
486485
} else {
487486
String::new()
488487
};

0 commit comments

Comments
 (0)