Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
2152633
refactor(self-update)!: extract Windows registry cleanup from `do_rem…
baka-gourd Jun 20, 2026
4d0da9d
refactor(self-update)!: extract add registry from `do_add_to_path()`
baka-gourd Jun 20, 2026
8520970
feat(self-update): route registry helpers through UUID subkeys
baka-gourd Jun 21, 2026
4f77a9b
chore: sync to main
baka-gourd Jul 2, 2026
dda7706
test: retain registry guard in CLI context
baka-gourd Jun 21, 2026
ef03c3d
test(self-update): add UUID registry test helpers
baka-gourd Jun 21, 2026
4202bde
test(self-update): migrate registry unit tests to UUID guards
baka-gourd Jun 21, 2026
f919bfc
test(installer): use context registry guard interactively
baka-gourd Jun 21, 2026
fda2873
test(paths): isolate Windows PATH smoke checks
baka-gourd Jun 21, 2026
3833f18
test(paths): use UUID subtree for remaining Windows PATH cases
baka-gourd Jun 21, 2026
b7abf1b
test(self-update): guard installed setup helpers
baka-gourd Jun 21, 2026
2a6c6fc
test(self-update): guard install smoke registry writes
baka-gourd Jun 21, 2026
0816f6a
test(self-update): isolate Programs display version check
baka-gourd Jun 21, 2026
4b3e1a8
style(test): access uuid field directly
baka-gourd Jun 21, 2026
716ef3b
test(windows): remove restore in guard
baka-gourd Jul 2, 2026
77b0e5c
test(env_var): remove unnecessary guard
baka-gourd Jul 2, 2026
e1f0d67
test(self-update): retain registry guard in self-update context
baka-gourd Jul 2, 2026
b49aa19
test(windows): assign registry UUIDs to CLI contexts
baka-gourd Jul 2, 2026
22dbde4
test(windows): reuse default registry UUID in install tests
baka-gourd Jul 2, 2026
5cf1433
test(windows): require UUIDs for registry test helpers
baka-gourd Jul 2, 2026
360e048
test(windows): remove registry guard override helper
baka-gourd Jul 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/cli/self_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ mod windows;
#[cfg(windows)]
pub use windows::complete_windows_uninstall;
#[cfg(all(windows, feature = "test"))]
pub use windows::{RegistryGuard, RegistryValueId, USER_PATH, get_path};
pub use windows::{RUSTUP_TEST_REGISTRY_UUID, RegistryGuard, RegistryValueId, USER_PATH, get_path};
#[cfg(windows)]
use windows::{do_add_to_path, do_remove_from_path};
use windows::{do_add_to_path, do_add_to_programs, do_remove_from_path, do_remove_from_programs};
#[cfg(windows)]
pub(crate) use windows::{run_update, self_replace};

Expand Down Expand Up @@ -323,7 +323,7 @@ impl SelfUpdateMode {
let setup_path = prepare_update(dl_cfg).await?;

if let Some(setup_path) = &setup_path {
return run_update(setup_path);
return run_update(setup_path, dl_cfg.process);
} else {
// Try again in case we emitted "tool `{}` is already installed" last time.
install_proxies(dl_cfg.process)?;
Expand Down Expand Up @@ -1009,6 +1009,9 @@ async fn maybe_install_rust(opts: InstallOpts<'_>, cfg: &mut Cfg<'_>) -> Result<
do_add_to_path(cfg.process)?;
}

#[cfg(windows)]
do_add_to_programs(cfg.process)?;

// If RUSTUP_HOME is not set, make sure it exists
if cfg.process.var_os("RUSTUP_HOME").is_none() {
let home = cfg
Expand Down Expand Up @@ -1158,6 +1161,9 @@ fn clean_cargo_home(no_modify_path: bool, process: &Process) -> Result<()> {

utils::remove_file("rustup_bin", &rustup_path)?;

#[cfg(windows)]
do_remove_from_programs(process)?;

let cargo_bin_display = cargo_bin.display();
info!("removing empty cargo bin directory `{cargo_bin_display}`");

Expand Down Expand Up @@ -1283,7 +1289,7 @@ pub(crate) async fn update(cfg: &Cfg<'_>) -> Result<ExitCode> {
PackageUpdate::Rustup,
Ok(UpdateStatus::Updated(version)),
);
return run_update(&setup_path);
return run_update(&setup_path, cfg.process);
}
None => {
let _ = common::show_channel_update(
Expand Down
2 changes: 1 addition & 1 deletion src/cli/self_update/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub(crate) fn do_write_env_files(process: &Process) -> Result<()> {

/// Tell the upgrader to replace the rustup bins, then delete
/// itself.
pub(crate) fn run_update(setup_path: &Path) -> Result<utils::ExitCode> {
pub(crate) fn run_update(setup_path: &Path, _process: &Process) -> Result<utils::ExitCode> {
let status = Command::new(setup_path)
.arg("--self-replace")
.status()
Expand Down
Loading
Loading