Skip to content

Give a warning before uninstalling the active/default toolchain, or the last/host target for a toolchain #3319

Closed
@jyn514

Description

@jyn514

Problem you are trying to solve

Rustup currently lets you do some silly things:

; rustup target list --installed
x86_64-unknown-linux-gnu
; rustup target remove x86_64-unknown-linux-gnu
info: removing component 'rust-std'
; cargo build
   Compiling inner v0.1.0 (/home/jyn/src/example/inner)
error[E0463]: can't find crate for `std`

This isn't a bug, but it seems ... confusing.

Solution you'd like

I think rustup should warn in either of the following cases:

  1. If you're trying to remove the host target, which means you can no longer build proc-macros or build scripts
  2. If you're trying to remove the last remaining target installed
  3. If you're uninstalling the active/default toolchain

Notes

No response

### Tasks
- [ ] https://github.com/rust-lang/rustup/pull/3637
- [ ] https://github.com/rust-lang/rustup/pull/3924

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions