Skip to content

Commit bfcde68

Browse files
Remove complete_windows_uninstall from unix.rs
1 parent 96c90cc commit bfcde68

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/bin/rustup-init.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@
1616

1717
use std::path::PathBuf;
1818

19+
use cfg_if::cfg_if;
1920
use rs_tracing::*;
2021

2122
use rustup::cli::common;
2223
use rustup::cli::errors::*;
2324
use rustup::cli::proxy_mode;
2425
use rustup::cli::rustup_mode;
26+
#[cfg(windows)]
2527
use rustup::cli::self_update;
2628
use rustup::cli::setup_mode;
2729
use rustup::currentprocess::{process, with, OSProcess};
@@ -83,7 +85,13 @@ fn run_rustup_inner() -> Result<utils::ExitCode> {
8385
Some(n) if n.starts_with("rustup-gc-") => {
8486
// This is the final uninstallation stage on windows where
8587
// rustup deletes its own exe
86-
self_update::complete_windows_uninstall()
88+
cfg_if! {
89+
if #[cfg(windows)] {
90+
self_update::complete_windows_uninstall()
91+
} else {
92+
unreachable!("Attempted to use Windows-specific code on a non-Windows platform. Aborting.")
93+
}
94+
}
8795
}
8896
Some(_) => proxy_mode::main(),
8997
None => {

src/cli/self_update.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ use crate::utils::Notification;
6666
use crate::{Cfg, UpdateStatus};
6767
use crate::{DUP_TOOLS, TOOLS};
6868
use os::*;
69-
pub use os::{complete_windows_uninstall, delete_rustup_and_cargo_home, run_update, self_replace};
69+
pub use os::{delete_rustup_and_cargo_home, run_update, self_replace};
70+
#[cfg(windows)]
71+
pub use windows::complete_windows_uninstall;
7072

7173
pub struct InstallOpts<'a> {
7274
pub default_host_triple: Option<String>,

src/cli/self_update/unix.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ pub fn delete_rustup_and_cargo_home() -> Result<()> {
5353
Ok(())
5454
}
5555

56-
pub fn complete_windows_uninstall() -> Result<utils::ExitCode> {
57-
panic!("stop doing that")
58-
}
59-
6056
pub fn do_remove_from_path() -> Result<()> {
6157
for sh in shell::get_available_shells() {
6258
let source_bytes = format!("{}\n", sh.source_string()?).into_bytes();

0 commit comments

Comments
 (0)