rust-lang / rust-lang/rustup

rustup won't force-skip unavailable `rust-std` for targets specified through `rust-toolchain.toml`

Open
#4,442 9 comments 1 reaction 1 assignee View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
22h 40m
Merged PRs (30d)
46

Description

Problem you are trying to solve

I have a no_std project that uses a custom target and the rust-toolchain.toml file. I have specified the custom target with the toolchain.targets key of the rust-toolchain.toml file. I have uninstalled all toolchains at this point so when i run cargo commands rustup tries installing one according to the config file, however this will always fail because rust-std doesn't exist for the custom target.

error: component 'rust-std' for target '<custom_target>' is unavailable for download for channel 'stable'
If you don't need the component, you could try a minimal installation with:

    rustup toolchain add stable --profile minimal

If you require these components, please install and use the latest successful build version,
which you can find at <https://rust-lang.github.io/rustup-components-history>.

After determining the correct date, install it with a command such as:

    rustup toolchain install nightly-2018-12-27

Then you can use the toolchain with commands such as:

    cargo +nightly-2018-12-27 build

The workaround for this is to install the toolchain for the host target first. Then, when running a cargo command, it will now say: warning: Force-skipping unavailable component 'rust-std-<custom_target> but proceed with the installation of i.e. extra components anyways. Finally it won't be an issue because it's a no_std environment anyways.

Solution you'd like

I would like a flag to disable the rust-std component from the rust-toolchain.toml file as in this particular use-case, human intervention might not be wanted if it runs as part of CI or similar.

Notes

If someone implements this enhancement i will suggest updating the hint it gives in the first error message i included where it tells you to set the profile to "minimal" since that will still include rust-std

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.