@@ -107,6 +107,11 @@ struct Opts {
107
107
) ]
108
108
with_cargo : bool ,
109
109
110
+ #[ structopt(
111
+ long = "with-src" , help = "Download rust-src, by default this is not downloaded"
112
+ ) ]
113
+ with_src : bool ,
114
+
110
115
#[ structopt(
111
116
long = "test-dir" ,
112
117
help = "Directory to test; this is where you usually run `cargo build`" ,
@@ -298,6 +303,7 @@ struct DownloadParams {
298
303
tmp_dir : PathBuf ,
299
304
install_dir : PathBuf ,
300
305
install_cargo : bool ,
306
+ install_src : bool ,
301
307
force_install : bool ,
302
308
}
303
309
@@ -314,6 +320,7 @@ impl DownloadParams {
314
320
tmp_dir : cfg. rustup_tmp_path . clone ( ) ,
315
321
install_dir : cfg. toolchains_path . clone ( ) ,
316
322
install_cargo : cfg. args . with_cargo ,
323
+ install_src : cfg. args . with_src ,
317
324
force_install : cfg. args . force_install ,
318
325
}
319
326
}
@@ -324,6 +331,7 @@ impl DownloadParams {
324
331
tmp_dir : cfg. rustup_tmp_path . clone ( ) ,
325
332
install_dir : cfg. toolchains_path . clone ( ) ,
326
333
install_cargo : cfg. args . with_cargo ,
334
+ install_src : cfg. args . with_src ,
327
335
force_install : cfg. args . force_install ,
328
336
}
329
337
}
@@ -613,6 +621,17 @@ impl Toolchain {
613
621
) . map_err ( InstallError :: Download ) ?;
614
622
}
615
623
624
+ if dl_params. install_src {
625
+ let filename = "rust-src-nightly" ;
626
+ download_tarball (
627
+ & client,
628
+ "rust-src" ,
629
+ & format ! ( "{}/{}/{}.tar" , dl_params. url_prefix, location, filename, ) ,
630
+ Some ( & PathBuf :: from ( & filename) . join ( "rust-src" ) ) ,
631
+ tmpdir. path ( ) ,
632
+ ) . map_err ( InstallError :: Download ) ?;
633
+ }
634
+
616
635
fs:: rename ( tmpdir. into_path ( ) , dest) . map_err ( InstallError :: Move ) ?;
617
636
618
637
Ok ( ( ) )
0 commit comments