When dealing with continuous like travis, I can specify a toolchain I want to have
````
language: rust
rust:
but not what components (rustfmt clippy) I want to install.
This means if I want to use clippy or rustfmt, I have to manually rustup component add it or, if the current nightly version does not ship it, try to somehow install it myself and hope it builds with the current rustc nightly.
It would be great to have some kind of option "install the lastest nightly that has components x and y available" which entails potentially downgrading to a earlier nightly if the current nightly does not ship the components but the later nightly does.
Perhaps rustup install nightly --needed-components=clippy,rustfmt or something like that.
The title of this issue is misleading... it talks about updating when the issue is about installation.
Could someone rename it appropriately? I think this is the better alternative to https://github.com/rust-lang/rustup.rs/issues/1602 and https://github.com/rust-lang/rustup.rs/issues/1676.
@RalfJung updated!
@RalfJung
it talks about updating when the issue is about installation
It would be nice if rustup update did the same thing though. Eg. get you the latest nightly that has your components.
@najamelan your comment consists only of quotes, looks like a formatting issue?
get you the latest nightly that has your components.
AFAIK if you have a component installed, rustup will only upgrade to nighties that have that component.
@RalfJung Sorry, it needed a white line to work there.
AFAIK if you have a component installed, rustup will only upgrade to nighties that have that component.
So the point is, if I have a nightly that is one month old, with components, and I run rustup update, if todays nightly doesn't have the components, it won't update anything at all, even if yesterdays nightly had the required components.
So I think lots of people would like for rustup to update to the latest nightly that has that component.
The issue is very similar for installs and updates, so I think both should considered together when trying to solve this.
@najamelan that will be the behavior with https://github.com/rust-lang/rustup.rs/pull/1997 :)
I believe this is covered by Rustup 1.20
Has this issue not really been fixed, or am I missing something? Right now, I am trying to add clippy to the CI of compiler-builtins. The GitHub Actions CI has to start by installing a fresh Rust with no components. Because the crate uses nightly features, we need the nightly version of clippy, but the component might not exist. It happens to exist right now, but my local rustup update does not update all the way to the same version of clippy that the CI uses (because of lack of other components), and I have already run into new lint issues that I can't readily test. This issue mentions rustup install nightly --needed-components=clippy,rustfmt, but that isn't what #1997 implements, and #1997 is unable to solve what rustup install nightly --needed-components=clippy,rustfmt could solve.
For nightly toolchains, the only approach I know of is to do what Miri also does when you want to run it in some project's CI:
MIRI_NIGHTLY=nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri)
echo "Installing latest nightly with Miri: $MIRI_NIGHTLY"
rustup set profile minimal
rustup default "$MIRI_NIGHTLY"
rustup component add miri
cargo miri test
Not sure what the nicest way is to put that into GHA.
Files like https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri exist for all tools, e.g. https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/clippy.
Thanks, I found the magic lines to be:
rustup set profile minimal && rustup default "nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/clippy)" && rustup component add clippy
cargo clippy -- -D clippy::all
Most helpful comment
@RalfJung Sorry, it needed a white line to work there.
So the point is, if I have a nightly that is one month old, with components, and I run
rustup update, if todays nightly doesn't have the components, it won't update anything at all, even if yesterdays nightly had the required components.So I think lots of people would like for rustup to update to the latest nightly that has that component.
The issue is very similar for installs and updates, so I think both should considered together when trying to solve this.