Selecting the latest nightly to have a specific set of features?

I'm in a bit of a bind.

I've got a project that relies on Nightly, because one of the dependencies also does. I test that project on Travis, which uses the minimal rustup profile, which installs very few components; my .travis.yml includes rustup component add clippy rustfmt at the appropriate time in order to ensure the components my build needs are present. Underlying that, my rust-toolchain file normally specifies nightly, unconditionally.

However, this only works most of the time. Occasionally, a version of nightly will be released without rustfmt, or without clippy. That's fine, and that's an advertised behaviour for the nightly channel. What I'd really like is a way to query rustup to ask "what is the latest nightly to have these components," and then to install that nightly. Is such a thing possible? Is such a thing practical?

curl -sSf | sh -s -- --profile complete --default-toolchain nightly should install a toolchain with everything.

However, there's still no guarantee that any nightly release is compatible with your code. Nightly features can change or be removed. For CI it's safest to pin nightly to a date and bump it manually.

1 Like

I'd go further and say, one should always pin the dependency versions for executables, because once you know it runs, why take the risk of breaking it for new or changed features, that won't be needed for your project.
The quote

Don't change a running system

has its merits. If your code works today, you also want your code to work in 10 years.

Personally, I also use cargo vendor, which pulls all your dependencies into your project folder. The disadvantage is obviously the project/repository size being negatively affected, but it enables you to not depend on some online resource being available in 10 to 20 years.

Node.js has proven just how fast a whole ecosystem dependent on 100% availability of online resources will break like a card house, if just a single dependency (card) is removed.

1 Like