My project's rustfmt Travis check on GitHub has recently stopped working due to an error from
rustup +nightly component add rustfmt:
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2020-07-15, rust version 1.46.0-nightly (23744c84d 2020-07-14)
info: downloading component 'cargo'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: installing component 'cargo'
info: Defaulting to 500.0 MiB unpack ram
info: installing component 'rust-std'
info: installing component 'rustc'
error: component 'rustfmt' for target 'x86_64-unknown-linux-gnu' is unavailable for download for channel nightly
Sometimes not all components are available in any given nightly.
Anyone know what the best way is to get nightly rustfmt features? Thanks in advance!
It happens that nightly doesn't contain all components. Nightly breaks internal things often, and they take a few days to catch up.
Try installing an older nightly.
Thanks @kornel. So if I don't want our Travis builds to break randomly, what should it do? Used a fixed nightly date?
When you install nightly via rustup you can add
--component complete to have it install everything, and it will find an older nightly that has everything.
I don't think there's a more precise option to make it require only rustfmt.
BTW: I hope you're not failing build on
rustfmt --check: https://internals.rust-lang.org/t/forced-rustfmt-is-a-roadblock-to-contributing/11913
Thanks! And yes, we are failing the builds. We don't have a lot of people clamoring to contribute as is, but we will reevaluate failing the build on rustfmt if someone (anyone) tries to contribute.
Ideally, there would be a bot that would comment on the PR saying "this isn't rustfmted, want me to commit a formatting fix?" with an @ command to fix it. I don't know of such a bot though.
BTW I haven't been able to get the
--component complete to work. What is the full command?
Oh, it turns out the installer script names this flag differently than rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --profile complete
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.