@@ -139,17 +139,6 @@ impl<'a> Toolchain<'a> {
139
139
Ok ( ( ) )
140
140
}
141
141
142
- // Custom and Distributable. Installed and not installed (because of install_from_dist_if_not_installed) Goes away?
143
- // Or perhaps a trait.
144
- pub fn is_valid_install_method ( & self , install_method : InstallMethod < ' _ > ) -> bool {
145
- match install_method {
146
- InstallMethod :: Copy ( _) | InstallMethod :: Link ( _) | InstallMethod :: Installer ( ..) => {
147
- self . is_custom ( )
148
- }
149
- InstallMethod :: Dist ( ..) => !self . is_custom ( ) ,
150
- }
151
- }
152
-
153
142
// XXX: Move to Config with a notify handler parameter
154
143
fn download_cfg ( & self ) -> DownloadCfg < ' _ > {
155
144
DownloadCfg {
@@ -186,6 +175,7 @@ impl<'a> Toolchain<'a> {
186
175
pub fn install_from_installers ( & self , installers : & [ & OsStr ] ) -> Result < ( ) > {
187
176
self . ensure_custom ( ) ?;
188
177
178
+ let custom = CustomToolchain :: new ( & self ) ?;
189
179
self . remove ( ) ?;
190
180
191
181
// FIXME: This should do all downloads first, then do
@@ -214,15 +204,17 @@ impl<'a> Toolchain<'a> {
214
204
utils:: download_file ( & url, & local_installer, None , & |n| {
215
205
( self . cfg . notify_handler ) ( n. into ( ) )
216
206
} ) ?;
217
- InstallMethod :: Installer ( & local_installer, & self . cfg . temp_cfg ) . install ( & self ) ?;
207
+ InstallMethod :: Installer ( & local_installer, & self . cfg . temp_cfg , & custom)
208
+ . install ( & self ) ?;
218
209
} else {
219
210
// If installer is a filename
220
211
221
212
// No need to download
222
213
let local_installer = Path :: new ( installer) ;
223
214
224
215
// Install from file
225
- InstallMethod :: Installer ( & local_installer, & self . cfg . temp_cfg ) . install ( & self ) ?;
216
+ InstallMethod :: Installer ( & local_installer, & self . cfg . temp_cfg , & custom)
217
+ . install ( & self ) ?;
226
218
}
227
219
}
228
220
@@ -232,6 +224,7 @@ impl<'a> Toolchain<'a> {
232
224
// Custom only. Not installed only.
233
225
pub fn install_from_dir ( & self , src : & Path , link : bool ) -> Result < ( ) > {
234
226
self . ensure_custom ( ) ?;
227
+ let custom = CustomToolchain :: new ( & self ) ?;
235
228
236
229
let mut pathbuf = PathBuf :: from ( src) ;
237
230
@@ -244,9 +237,9 @@ impl<'a> Toolchain<'a> {
244
237
utils:: assert_is_file ( & pathbuf) ?;
245
238
246
239
if link {
247
- InstallMethod :: Link ( & utils:: to_absolute ( src) ?) . install ( & self ) ?;
240
+ InstallMethod :: Link ( & utils:: to_absolute ( src) ?, & custom ) . install ( & self ) ?;
248
241
} else {
249
- InstallMethod :: Copy ( src) . install ( & self ) ?;
242
+ InstallMethod :: Copy ( src, & custom ) . install ( & self ) ?;
250
243
}
251
244
252
245
Ok ( ( ) )
@@ -731,6 +724,7 @@ impl<'a> DistributableToolchain<'a> {
731
724
old_date. as_ref ( ) . map ( |s| & * * s) ,
732
725
components,
733
726
targets,
727
+ & self ,
734
728
)
735
729
. install ( & self . 0 )
736
730
}
@@ -751,6 +745,7 @@ impl<'a> DistributableToolchain<'a> {
751
745
None ,
752
746
& [ ] ,
753
747
& [ ] ,
748
+ & self ,
754
749
)
755
750
. install ( & self . 0 ) ?)
756
751
} else {
0 commit comments