Skip to content

Suggest another toolchain when removing a component unavailable to the current toolchain #5098

Description

@rami3l

Similar to the case in #4164:

  1. rustup update fails (unrelated to issue)
    Image
  2. rustup target remove wasm32-wasi fails
    Image
  3. rustup +target remove wasm32-wasi succeeds, as the default toolchain was nightly as specified in .rustup/settings.toml

... however the related error kind is RustupError::UnknownComponents which would be emitted during both rustup component add and rustup component rm (instead of the rustup target rm command shown above):

rustup/src/errors.rs

Lines 141 to 145 in 2919b80

#[error("{}", unknown_components_msg(.desc, .components))]
UnknownComponents {
desc: ToolchainDesc,
components: Vec<UnknownComponentInfo>,
},

... so we should be smarter in terms of suggestions. Or, as a simplification, if suggesting rustup component add turns out to be non trivial, we can do the rustup component rm case first.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions