@@ -180,7 +180,7 @@ static PKG_INSTALLERS: &[&str] = &["x86_64-apple-darwin", "aarch64-apple-darwin"
180
180
181
181
static MINGW : & [ & str ] = & [ "i686-pc-windows-gnu" , "x86_64-pc-windows-gnu" ] ;
182
182
183
- static NIGHTLY_ONLY_COMPONENTS : & [ & str ] = & [ "miri-preview" , "rust-docs-json-preview" ] ;
183
+ static NIGHTLY_ONLY_COMPONENTS : & [ PkgType ] = & [ PkgType :: Miri , PkgType :: JsonDocs ] ;
184
184
185
185
macro_rules! t {
186
186
( $e: expr) => {
@@ -285,12 +285,7 @@ impl Builder {
285
285
fn add_packages_to ( & mut self , manifest : & mut Manifest ) {
286
286
for pkg in PkgType :: all ( ) {
287
287
let fallback = if pkg. use_docs_fallback ( ) { DOCS_FALLBACK } else { & [ ] } ;
288
- self . package (
289
- & pkg. manifest_component_name ( ) ,
290
- & mut manifest. pkg ,
291
- pkg. targets ( ) ,
292
- fallback,
293
- ) ;
288
+ self . package ( pkg, & mut manifest. pkg , fallback) ;
294
289
}
295
290
}
296
291
@@ -401,26 +396,27 @@ impl Builder {
401
396
let mut components = Vec :: new ( ) ;
402
397
let mut extensions = Vec :: new ( ) ;
403
398
404
- let host_component = |pkg : & _ | Component :: from_str ( pkg, host) ;
399
+ let host_component = |pkg : & _ | Component :: from_pkg ( pkg, host) ;
405
400
406
401
for pkg in PkgType :: all ( ) {
407
402
match pkg {
408
403
// rustc/rust-std/cargo/docs are all required
409
404
PkgType :: Rustc | PkgType :: Cargo | PkgType :: HtmlDocs => {
410
- components. push ( host_component ( & pkg. manifest_component_name ( ) ) ) ;
405
+ components. push ( host_component ( pkg) ) ;
411
406
}
412
407
PkgType :: RustStd => {
413
- components. push ( host_component ( & pkg. manifest_component_name ( ) ) ) ;
408
+ components. push ( host_component ( pkg) ) ;
414
409
extensions. extend (
415
- TARGETS . iter ( ) . filter ( |& & target| target != host) . map ( |target| {
416
- Component :: from_str ( & pkg. manifest_component_name ( ) , target)
417
- } ) ,
410
+ TARGETS
411
+ . iter ( )
412
+ . filter ( |& & target| target != host)
413
+ . map ( |target| Component :: from_pkg ( pkg, target) ) ,
418
414
) ;
419
415
}
420
416
// so is rust-mingw if it's available for the target
421
417
PkgType :: RustMingw => {
422
418
if host. contains ( "pc-windows-gnu" ) {
423
- components. push ( host_component ( "rust-mingw" ) ) ;
419
+ components. push ( host_component ( pkg ) ) ;
424
420
}
425
421
}
426
422
// Tools are always present in the manifest,
@@ -433,20 +429,16 @@ impl Builder {
433
429
| PkgType :: LlvmTools
434
430
| PkgType :: RustAnalysis
435
431
| PkgType :: JsonDocs => {
436
- extensions. push ( host_component ( & pkg. manifest_component_name ( ) ) ) ;
432
+ extensions. push ( host_component ( pkg) ) ;
437
433
}
438
434
PkgType :: RustcDev | PkgType :: RustcDocs => {
439
- extensions. extend (
440
- HOSTS . iter ( ) . map ( |target| {
441
- Component :: from_str ( & pkg. manifest_component_name ( ) , target)
442
- } ) ,
443
- ) ;
435
+ extensions. extend ( HOSTS . iter ( ) . map ( |target| Component :: from_pkg ( pkg, target) ) ) ;
444
436
}
445
437
PkgType :: RustSrc => {
446
- extensions. push ( Component :: from_str ( & pkg. manifest_component_name ( ) , "*" ) ) ;
438
+ extensions. push ( Component :: from_pkg ( pkg, "*" ) ) ;
447
439
}
448
- PkgType :: Rust | PkgType :: Other ( _ ) => { }
449
- // FIXME: is this correct? maybe we should add it so rustup knows about it ...
440
+ PkgType :: Rust => { }
441
+ // NOTE: this is intentional, these artifacts aren't intended to be used with rustup
450
442
PkgType :: ReproducibleArtifacts => { }
451
443
}
452
444
}
@@ -494,31 +486,27 @@ impl Builder {
494
486
495
487
fn package (
496
488
& mut self ,
497
- pkgname : & str ,
489
+ pkg : & PkgType ,
498
490
dst : & mut BTreeMap < String , Package > ,
499
- targets : & [ & str ] ,
500
491
fallback : & [ ( & str , & str ) ] ,
501
492
) {
502
- if pkgname == "rust" {
493
+ if * pkg == PkgType :: Rust {
503
494
// This is handled specially by `rust_package` later.
504
495
// Order is important, so don't call `rust_package` here.
505
496
return ;
506
497
}
507
498
508
- let version_info = self
509
- . versions
510
- . version ( & PkgType :: from_component ( pkgname) )
511
- . expect ( "failed to load package version" ) ;
499
+ let version_info = self . versions . version ( & pkg) . expect ( "failed to load package version" ) ;
512
500
let mut is_present = version_info. present ;
513
501
514
502
// Never ship nightly-only components for other trains.
515
- if self . versions . channel ( ) != "nightly" && NIGHTLY_ONLY_COMPONENTS . contains ( & pkgname ) {
503
+ if self . versions . channel ( ) != "nightly" && NIGHTLY_ONLY_COMPONENTS . contains ( & pkg ) {
516
504
is_present = false ; // Pretend the component is entirely missing.
517
505
}
518
506
519
507
macro_rules! tarball_name {
520
508
( $target_name: expr) => {
521
- self . versions. tarball_name( & PkgType :: from_component ( pkgname ) , $target_name) . unwrap( )
509
+ self . versions. tarball_name( pkg , $target_name) . unwrap( )
522
510
} ;
523
511
}
524
512
let mut target_from_compressed_tar = |target_name| {
@@ -547,7 +535,8 @@ impl Builder {
547
535
Target :: unavailable ( )
548
536
} ;
549
537
550
- let targets = targets
538
+ let targets = pkg
539
+ . targets ( )
551
540
. iter ( )
552
541
. map ( |name| {
553
542
let target = if is_present {
@@ -562,7 +551,7 @@ impl Builder {
562
551
. collect ( ) ;
563
552
564
553
dst. insert (
565
- pkgname . to_string ( ) ,
554
+ pkg . manifest_component_name ( ) ,
566
555
Package {
567
556
version : version_info. version . unwrap_or_default ( ) ,
568
557
git_commit_hash : version_info. git_commit ,
0 commit comments