Skip to content

uninstalls toolchains prior to deleting the rustup home folder#2864

Merged
rami3l merged 1 commit into
rust-lang:mainfrom
Darunada:self-uninstall-remove-toolchains
Jul 8, 2026
Merged

uninstalls toolchains prior to deleting the rustup home folder#2864
rami3l merged 1 commit into
rust-lang:mainfrom
Darunada:self-uninstall-remove-toolchains

Conversation

@Darunada

@Darunada Darunada commented Oct 9, 2021

Copy link
Copy Markdown
Contributor

Fixes #2789

I was able to reproduce the issue, and with this change the command now succeeds with the following output.

C:\Users\Lea>rustup self uninstall


Thanks for hacking in Rust!

This will uninstall all Rust toolchains and data, and remove
%USERPROFILE%\.cargo/bin from your PATH environment variable.

Continue? (y/N) y

info: removing toolchains
info: uninstalling toolchain nightly-x86_64-pc-windows-msvc
info: toolchain nightly-x86_64-pc-windows-msvc uninstalled
info: uninstalling toolchain stage2
info: toolchain stage2 uninstalled
info: removing rustup home
info: removing cargo home
info: removing rustup binaries
info: rustup is uninstalled

@kinnison kinnison left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see at least one test validating that this uninstall is happening. Probably it ought to be a new test in tests/cli-self-upd.rs something like an fn uninstall_removes_installed_toolchains()

@Darunada

Copy link
Copy Markdown
Contributor Author

sure thing, work has gotten a bit more stressful in the last couple weeks, I will try to do something this weekend

@0xPoe

0xPoe commented Sep 30, 2022

Copy link
Copy Markdown
Member

@Darunada Do you still have time to advance it? If you don't have time I would be happy to help add that test. But it would be great if you could move forward. Thanks!

@Darunada Darunada force-pushed the self-uninstall-remove-toolchains branch 2 times, most recently from 5a9b7a0 to 4abc90a Compare February 25, 2023 19:11
@Darunada Darunada marked this pull request as draft February 25, 2023 19:29
@Darunada Darunada force-pushed the self-uninstall-remove-toolchains branch from 2e7c6c9 to 6745cd9 Compare February 25, 2023 20:54
@Darunada Darunada marked this pull request as ready for review February 25, 2023 21:41
@Darunada

Copy link
Copy Markdown
Contributor Author

Sorry for the delay, I went ahead and added a test. Let me know if you like the approach!

@Darunada Darunada requested a review from kinnison February 25, 2023 21:42
Comment thread src/cli/rustup_mode.rs Outdated
@rustbot

This comment has been minimized.

@Darunada Darunada force-pushed the self-uninstall-remove-toolchains branch from 511cf7b to e6b5581 Compare March 16, 2026 02:38
@rustbot

This comment has been minimized.

@Darunada

Copy link
Copy Markdown
Contributor Author

Hello team, I am once again prepared for your reconsideration

@djc djc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM, thanks for updating after all those years!

(Please also squash your changes into a single commit.)

View changes since this review

Comment thread src/cli/self_update.rs Outdated
@Darunada Darunada force-pushed the self-uninstall-remove-toolchains branch 2 times, most recently from fa875e7 to 1c5484e Compare July 8, 2026 05:47
@rustbot

This comment has been minimized.

@rustbot

rustbot commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Darunada Darunada force-pushed the self-uninstall-remove-toolchains branch 2 times, most recently from 83b41c7 to 239a9e1 Compare July 8, 2026 06:37
Comment thread src/cli/self_update.rs
@Darunada Darunada force-pushed the self-uninstall-remove-toolchains branch from 239a9e1 to 5ed5ea5 Compare July 8, 2026 06:49
@rami3l rami3l enabled auto-merge July 8, 2026 06:51
@rami3l rami3l added this pull request to the merge queue Jul 8, 2026
Merged via the queue into rust-lang:main with commit 06111c1 Jul 8, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rustup self uninstall fails on Windows if a custom toolchain is installed

6 participants