Skip to content

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

@Pizza989

Description

@Pizza989

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions