Skip to content

Current tests run on Windows will accidently clears installed registry values by normal installation of rustup #4915

Description

@baka-gourd

Verification

Problem

This bug was originally discovered by @Cloud0310 , but due to operating system limitations, it could not be reproduced independently; I was able to reproduce the issue.

Currently, some tests incorrectly clear the properly installed Windows RustUp registry values while running. like:

cargo test --features test --test test_bonanza suite::cli_self_upd::uninstall_deletes_bins -- --exact --nocapture

This is a clear violation of the rules and will result in the properly installed version of Rust on the developers' computers being accidentally “uninstalled.”

Steps

  1. For test, backup HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\Rustup in anywhere
  2. Ran cargo test --features test --test test_bonanza suite::cli_self_upd::uninstall_deletes_bins -- --exact --nocapture
  3. Values in the registry may be accidentally deleted. You can use Get-ItemProperty -Path <mentioned key before> to verify this.

Possible Solution(s)

Decoupling File Deletion from Registry Cleanup

Notes

This is because the method for removing directories is tightly coupled with the method for removing files.

pub(crate) fn do_remove_from_path(process: &Process) -> Result<()> {
let new_path = _with_path_cargo_home_bin(_remove_from_path, process)?;
_apply_new_path(new_path)?;
do_remove_from_programs()
}

Rustup version

rustup 1.29.0 (28d1352db 2026-03-05)

Installed toolchains

installed toolchains
--------------------
stable-x86_64-pc-windows-gnu
stable-x86_64-pc-windows-msvc (active, default)
stable-x86_64-unknown-linux-gnu
nightly-x86_64-pc-windows-msvc
1.78-x86_64-pc-windows-msvc
1.80-x86_64-pc-windows-msvc
1.86-x86_64-pc-windows-msvc
1.90.0-x86_64-pc-windows-msvc
1.93-x86_64-pc-windows-msvc

active toolchain
----------------
name: stable-x86_64-pc-windows-msvc
active because: it's the default toolchain
installed targets:
  x86_64-pc-windows-msvc
  x86_64-unknown-linux-gnu

OS version

Windows 25H2(26220.8690)

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions