@@ -24,7 +24,7 @@ use crate::core::compiler::unit_graph::{UnitDep, UnitGraph};
24
24
use crate :: core:: compiler:: {
25
25
CompileKind , CompileMode , CrateType , RustcTargetData , Unit , UnitInterner ,
26
26
} ;
27
- use crate :: core:: dependency:: { Artifact , ArtifactTarget , DepKind } ;
27
+ use crate :: core:: dependency:: { Artifact , ArtifactKind , ArtifactTarget , DepKind } ;
28
28
use crate :: core:: profiles:: { Profile , Profiles , UnitFor } ;
29
29
use crate :: core:: resolver:: features:: { FeaturesFor , ResolvedFeatures } ;
30
30
use crate :: core:: resolver:: Resolve ;
@@ -555,17 +555,20 @@ fn artifact_targets_to_unit_deps(
555
555
let ret =
556
556
match_artifacts_kind_with_targets ( dep, artifact_pkg. targets ( ) , parent. pkg . name ( ) . as_str ( ) ) ?
557
557
. into_iter ( )
558
- . map ( |( _artifact_kind, target) | target)
559
- . flat_map ( |target| {
558
+ . flat_map ( |( artifact_kind, target) | {
560
559
// We split target libraries into individual units, even though rustc is able
561
- // to produce multiple kinds in an single invocation for the sole reason that
560
+ // to produce multiple kinds in a single invocation for the sole reason that
562
561
// each artifact kind has its own output directory, something we can't easily
563
562
// teach rustc for now.
564
563
match target. kind ( ) {
565
564
TargetKind :: Lib ( kinds) => Box :: new (
566
565
kinds
567
566
. iter ( )
568
- . filter ( |tk| matches ! ( tk, CrateType :: Cdylib | CrateType :: Staticlib ) )
567
+ . filter ( move |tk| match ( tk, artifact_kind) {
568
+ ( CrateType :: Cdylib , ArtifactKind :: Cdylib ) => true ,
569
+ ( CrateType :: Staticlib , ArtifactKind :: Staticlib ) => true ,
570
+ _ => false ,
571
+ } )
569
572
. map ( |target_kind| {
570
573
new_unit_dep (
571
574
state,
0 commit comments