Perform similar checks to when resolving toolchains in order to
reduce the possibility that the configuration will end up with an
unusable default-host value. This finally addresses the initial
point in #745 and thus fixes it.
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
To make sure that people using editors which use rustfmt by default
on saving don't touch more lines than intended when working on the
rustup codebase, we'll take the hit to format it all once.
This adds a new test and removes test `update_removes_components_that_dont_exist`
Historically, this test was added before the check that aborts update on missing
components (which is tested by the new test in the previous commit, as well as
elsewhere), so I think this test was only testing a bug.
Note that the new behaviour is the same as the ancient behviour when the user
uses `--force`
A typical scenario is:
* I work on a repository that uses `rust-toolchain` to pin to a specific Nightly version
* I run `git pull`, `rust-toolchain` has been changed to update to a new Rust version
* I run `cargo build`
Result before this PR (typically): rustup fails with an error like:
```
error: override toolchain 'nightly-2017-08-31' is not installed
info: caused by: the toolchain file at '/home/simon/projects/servo/rust-toolchain' specifies an uninstalled toolchain
```
A better result would be to install toolchains as needed.
Closes#1218
This commit edits tests to allow tests to run in parallel instead of taking
global locks. This works by avoiding `env::set_current_dir` and instead tracking
the current directory in the `Config` structure, where all child processes get
an updated cwd.
This adds a .rust-version file similar to rbenv's .ruby-version.
The form of toolchain supported here is limited to channel names,
explicit versions, and optional archive dates.