@@ -107,7 +107,6 @@ pub(crate) struct InstallOpts<'a> {
107107 pub no_update_toolchain : bool ,
108108 pub components : & ' a [ & ' a str ] ,
109109 pub targets : & ' a [ & ' a str ] ,
110- pub process : & ' a Process ,
111110}
112111
113112impl InstallOpts < ' _ > {
@@ -122,12 +121,11 @@ impl InstallOpts<'_> {
122121 current_dir : PathBuf ,
123122 no_prompt : bool ,
124123 quiet : bool ,
124+ process : & Process ,
125125 ) -> Result < ExitCode > {
126126 #[ cfg_attr( not( unix) , allow( unused_mut) ) ]
127127 let mut exit_code = ExitCode :: SUCCESS ;
128128
129- let process = self . process ;
130-
131129 self . validate ( process) . map_err ( |e| {
132130 anyhow ! (
133131 "Pre-checks for host and toolchain failed: {e}\n \
@@ -161,7 +159,7 @@ impl InstallOpts<'_> {
161159 md ( & mut term, msg) ;
162160 let mut customized_install = false ;
163161 loop {
164- md ( & mut term, current_install_opts ( & self ) ) ;
162+ md ( & mut term, current_install_opts ( & self , process ) ) ;
165163 match common:: confirm_advanced ( customized_install, process) ? {
166164 Confirm :: No => {
167165 info ! ( "aborting installation" ) ;
@@ -177,7 +175,7 @@ impl InstallOpts<'_> {
177175 }
178176
179177 let no_modify_path = self . no_modify_path ;
180- if let Err ( e) = self . install_rust ( current_dir, quiet) . await {
178+ if let Err ( e) = self . install_rust ( current_dir, quiet, process ) . await {
181179 report_error ( & e, process) ;
182180
183181 // On windows, where installation happens in a console
@@ -237,28 +235,32 @@ impl InstallOpts<'_> {
237235 }
238236
239237 /// Installs the rustup binary and proxies, and installs a toolchain if specified.
240- async fn install_rust ( self , current_dir : PathBuf , quiet : bool ) -> Result < ( ) > {
241- install_bins ( self . process ) ?;
238+ async fn install_rust (
239+ self ,
240+ current_dir : PathBuf ,
241+ quiet : bool ,
242+ process : & Process ,
243+ ) -> Result < ( ) > {
244+ install_bins ( process) ?;
242245
243246 #[ cfg( unix) ]
244- unix:: do_write_env_files ( self . process ) ?;
247+ unix:: do_write_env_files ( process) ?;
245248
246249 if !self . no_modify_path {
247- do_add_to_path ( self . process ) ?;
250+ do_add_to_path ( process) ?;
248251 }
249252
250253 // If RUSTUP_HOME is not set, make sure it exists
251- if self . process . var_os ( "RUSTUP_HOME" ) . is_none ( ) {
252- let home = self
253- . process
254+ if process. var_os ( "RUSTUP_HOME" ) . is_none ( ) {
255+ let home = process
254256 . home_dir ( )
255257 . map ( |p| p. join ( ".rustup" ) )
256258 . ok_or_else ( || anyhow:: anyhow!( "could not find home dir to put .rustup in" ) ) ?;
257259
258260 fs:: create_dir_all ( home) . context ( "unable to create ~/.rustup" ) ?;
259261 }
260262
261- let mut cfg = Cfg :: from_env ( current_dir, quiet, false , self . process ) ?;
263+ let mut cfg = Cfg :: from_env ( current_dir, quiet, false , process) ?;
262264
263265 let ( components, targets) = ( self . components , self . targets ) ;
264266 let toolchain = self . select_toolchain ( & mut cfg) ?;
@@ -303,7 +305,6 @@ impl InstallOpts<'_> {
303305 no_update_toolchain,
304306 components,
305307 targets,
306- ..
307308 } = self ;
308309
309310 cfg. set_profile ( profile) ?;
@@ -700,7 +701,7 @@ fn pre_install_msg(no_modify_path: bool, process: &Process) -> Result<String> {
700701 }
701702}
702703
703- fn current_install_opts ( opts : & InstallOpts < ' _ > ) -> String {
704+ fn current_install_opts ( opts : & InstallOpts < ' _ > , process : & Process ) -> String {
704705 format ! (
705706 r"Current installation options:
706707
@@ -712,7 +713,7 @@ fn current_install_opts(opts: &InstallOpts<'_>) -> String {
712713 opts. default_host_tuple
713714 . as_ref( )
714715 . map( TargetTuple :: new)
715- . unwrap_or_else( || TargetTuple :: from_host_or_build( opts . process) ) ,
716+ . unwrap_or_else( || TargetTuple :: from_host_or_build( process) ) ,
716717 match & opts. default_toolchain {
717718 Some ( name) => name. to_string( ) ,
718719 None => "stable (default)" . to_owned( ) ,
@@ -1385,7 +1386,6 @@ mod tests {
13851386 components : & [ ] ,
13861387 targets : & [ ] ,
13871388 no_update_toolchain : false ,
1388- process : & tp. process ,
13891389 } ;
13901390
13911391 assert_eq ! (
0 commit comments