@@ -499,17 +499,18 @@ impl<'gctx> PackageSet<'gctx> {
499
499
force_all_targets : ForceAllTargets ,
500
500
) -> CargoResult < ( ) > {
501
501
fn collect_used_deps (
502
- used : & mut BTreeSet < PackageId > ,
502
+ used : & mut BTreeSet < ( PackageId , CompileKind ) > ,
503
503
resolve : & Resolve ,
504
504
pkg_id : PackageId ,
505
505
has_dev_units : HasDevUnits ,
506
- requested_kinds : & [ CompileKind ] ,
506
+ requested_kind : CompileKind ,
507
507
target_data : & RustcTargetData < ' _ > ,
508
508
force_all_targets : ForceAllTargets ,
509
509
) -> CargoResult < ( ) > {
510
- if !used. insert ( pkg_id) {
510
+ if !used. insert ( ( pkg_id, requested_kind ) ) {
511
511
return Ok ( ( ) ) ;
512
512
}
513
+ let requested_kinds = & [ requested_kind] ;
513
514
let filtered_deps = PackageSet :: filter_deps (
514
515
pkg_id,
515
516
resolve,
@@ -524,7 +525,7 @@ impl<'gctx> PackageSet<'gctx> {
524
525
resolve,
525
526
pkg_id,
526
527
has_dev_units,
527
- requested_kinds ,
528
+ requested_kind ,
528
529
target_data,
529
530
force_all_targets,
530
531
) ?;
@@ -538,16 +539,22 @@ impl<'gctx> PackageSet<'gctx> {
538
539
let mut to_download = BTreeSet :: new ( ) ;
539
540
540
541
for id in root_ids {
541
- collect_used_deps (
542
- & mut to_download,
543
- resolve,
544
- * id,
545
- has_dev_units,
546
- requested_kinds,
547
- target_data,
548
- force_all_targets,
549
- ) ?;
542
+ for requested_kind in requested_kinds {
543
+ collect_used_deps (
544
+ & mut to_download,
545
+ resolve,
546
+ * id,
547
+ has_dev_units,
548
+ * requested_kind,
549
+ target_data,
550
+ force_all_targets,
551
+ ) ?;
552
+ }
550
553
}
554
+ let to_download = to_download
555
+ . into_iter ( )
556
+ . map ( |( p, _) | p)
557
+ . collect :: < BTreeSet < _ > > ( ) ;
551
558
self . get_many ( to_download. into_iter ( ) ) ?;
552
559
Ok ( ( ) )
553
560
}
0 commit comments