Allow rustup-init to install the default toolchain from a toolchain file
This PR allows rustup-init to install a default toolchain from a specified toolchain file.
In the current draft PR:
-
The toolchain file is only checked for the channel field, which to the best of my knowledge corresponds to the
toolchainfield. I could also add overrides for the other fields which can be specified in the toolchain file: thetarget(in rust-toolchain.toml)/host(in rustup), thecomponentsand theprofile. -
I re-used the name suggested by @XAMPPRocky,
--from-file. -
The toolchain specified by the toolchain file is only used if the
--default-toolchainoption is not given. -
The parse mode is determined based on the file extension, if it has a
tomlfile extension, theTomlOnlymode is used, else, the legacy mode is available. When the toolchain file is used to override current toolchain, the toolchain file name is fixed. In the suggested option this is not necessarily the case, so I opted to take this middle ground for now. -
I will add extra test cases in a bit (I'm a bit figuring out how the testing setup works :))
closes #2749
Please see #2686 : I'm glad you're putting effort into this, but the immediate effort needed is probably some design / hallway testing work.