@@ -401,42 +401,55 @@ impl Builder {
401
401
let mut components = Vec :: new ( ) ;
402
402
let mut extensions = Vec :: new ( ) ;
403
403
404
- let host_component = |pkg| Component :: from_str ( pkg, host) ;
405
-
406
- // rustc/rust-std/cargo/docs are all required,
407
- // and so is rust-mingw if it's available for the target.
408
- components. extend ( vec ! [
409
- host_component( "rustc" ) ,
410
- host_component( "rust-std" ) ,
411
- host_component( "cargo" ) ,
412
- host_component( "rust-docs" ) ,
413
- ] ) ;
414
- if host. contains ( "pc-windows-gnu" ) {
415
- components. push ( host_component ( "rust-mingw" ) ) ;
416
- }
404
+ let host_component = |pkg : & _ | Component :: from_str ( pkg, host) ;
417
405
418
- // Tools are always present in the manifest,
419
- // but might be marked as unavailable if they weren't built.
420
- extensions. extend ( vec ! [
421
- host_component( "clippy-preview" ) ,
422
- host_component( "miri-preview" ) ,
423
- host_component( "rls-preview" ) ,
424
- host_component( "rust-analyzer-preview" ) ,
425
- host_component( "rustfmt-preview" ) ,
426
- host_component( "llvm-tools-preview" ) ,
427
- host_component( "rust-analysis" ) ,
428
- host_component( "rust-docs-json-preview" ) ,
429
- ] ) ;
430
-
431
- extensions. extend (
432
- TARGETS
433
- . iter ( )
434
- . filter ( |& & target| target != host)
435
- . map ( |target| Component :: from_str ( "rust-std" , target) ) ,
436
- ) ;
437
- extensions. extend ( HOSTS . iter ( ) . map ( |target| Component :: from_str ( "rustc-dev" , target) ) ) ;
438
- extensions. extend ( HOSTS . iter ( ) . map ( |target| Component :: from_str ( "rustc-docs" , target) ) ) ;
439
- extensions. push ( Component :: from_str ( "rust-src" , "*" ) ) ;
406
+ for pkg in PkgType :: all ( ) {
407
+ match pkg {
408
+ // rustc/rust-std/cargo/docs are all required
409
+ PkgType :: Rustc | PkgType :: Cargo | PkgType :: HtmlDocs => {
410
+ components. push ( host_component ( & pkg. manifest_component_name ( ) ) ) ;
411
+ }
412
+ PkgType :: RustStd => {
413
+ components. push ( host_component ( & pkg. manifest_component_name ( ) ) ) ;
414
+ extensions. extend (
415
+ TARGETS . iter ( ) . filter ( |& & target| target != host) . map ( |target| {
416
+ Component :: from_str ( & pkg. manifest_component_name ( ) , target)
417
+ } ) ,
418
+ ) ;
419
+ }
420
+ // so is rust-mingw if it's available for the target
421
+ PkgType :: RustMingw => {
422
+ if host. contains ( "pc-windows-gnu" ) {
423
+ components. push ( host_component ( "rust-mingw" ) ) ;
424
+ }
425
+ }
426
+ // Tools are always present in the manifest,
427
+ // but might be marked as unavailable if they weren't built.
428
+ PkgType :: Clippy
429
+ | PkgType :: Miri
430
+ | PkgType :: Rls
431
+ | PkgType :: RustAnalyzer
432
+ | PkgType :: Rustfmt
433
+ | PkgType :: LlvmTools
434
+ | PkgType :: RustAnalysis
435
+ | PkgType :: JsonDocs => {
436
+ extensions. push ( host_component ( & pkg. manifest_component_name ( ) ) ) ;
437
+ }
438
+ PkgType :: RustcDev | PkgType :: RustcDocs => {
439
+ extensions. extend (
440
+ HOSTS . iter ( ) . map ( |target| {
441
+ Component :: from_str ( & pkg. manifest_component_name ( ) , target)
442
+ } ) ,
443
+ ) ;
444
+ }
445
+ PkgType :: RustSrc => {
446
+ extensions. push ( Component :: from_str ( & pkg. manifest_component_name ( ) , "*" ) ) ;
447
+ }
448
+ PkgType :: Rust | PkgType :: Other ( _) => { }
449
+ // FIXME: is this correct? maybe we should add it so rustup knows about it ...
450
+ PkgType :: ReproducibleArtifacts => { }
451
+ }
452
+ }
440
453
441
454
// If the components/extensions don't actually exist for this
442
455
// particular host/target combination then nix it entirely from our
0 commit comments