rust-lang / rust-lang/rustup

Miri becomes unusable, when it is unavailable and override file is present

Open
#3,000 1 comment 0 reactions 0 assignees 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

The tool miri can become unusable from a project with a rust-toolchain.toml, if it is unavailable for the current nightly, even if it is set as a required component like this:

[toolchain]
channel = "nightly"
components = [ "miri" ]
Steps

Prerequisite: miri is unavailable for the latest nighly.

  1. rustup toolchain install nightly --component miri
  2. cargo new my_project
  3. cd my_project, create rust-toolchain.toml file with content from above.
  4. cargo miri -V

Expected behavior

Rustup keeps the most recent nighly with miri, miri is usable.

Actual behavior

Rustup force-updates to the latest nighly, uninstalling miri in the process.

> cargo miri -V
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2022-05-29, rust version 1.63.0-nightly (1fede1753 2022-05-28)
warning: Force-skipping unavailable component 'miri-x86_64-unknown-linux-gnu'
warning: Force-skipping unavailable component 'rust-std-x86_64-unknown-uefi'
info: downloading component 'rust-src'
info: downloading component 'rust-std' for 'x86_64-unknown-none'
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: removing previous version of component 'cargo'
info: removing previous version of component 'clippy'
info: removing previous version of component 'miri'
info: removing previous version of component 'rust-docs'
info: removing previous version of component 'rust-std'
info: removing previous version of component 'rustc'
info: removing previous version of component 'rustfmt'
info: installing component 'rust-src'
info: installing component 'rust-std' for 'x86_64-unknown-none'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
error: the 'miri' component which provides the command 'cargo-miri' is not available for the 'nightly-x86_64-unknown-linux-gnu' toolchain
Possible Solution(s)
  • Make rustup use the latest version with all components listed in rust-toolchain.toml by default; or
  • Add an option to rust-toolchain.toml to disable force update.
Notes

We need to consider, that a component that is listed in the toolchain file might never be never available for a target.

For example, one of my projects rust-toolchain.toml looks like this:

[toolchain]
channel = "nightly"
components = [ "rust-src", "miri" ]
targets = [ "x86_64-unknown-none", "x86_64-unknown-uefi" ]

With the (implicit) component rust-std being unavailable for x86_64-unknown-uefi.

Rustup version
rustup 1.24.3 (2021-11-09)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.63.0-nightly (ebbcbfc23 2022-05-27)`
Installed toolchains
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/lukas/.rustup

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default)

active toolchain
----------------

nightly-x86_64-unknown-linux-gnu (overridden by '/home/lukas/code/miri_unavailable/rust-toolchain.toml')
rustc 1.63.0-nightly (ebbcbfc23 2022-05-27)

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.

Research direction

Reproduce the issue using the supplied rust-toolchain.toml with nightly and miri unavailable, then trace rustup's toolchain resolution and component installation from the override. Done means an unavailable required component does not replace a usable installed nightly, while target-specific unavailable components remain handled appropriately.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.