@@ -170,6 +170,7 @@ pub enum CompileFilter<'a> {
170
170
required_features_filterable : bool ,
171
171
} ,
172
172
Only {
173
+ all_targets : bool ,
173
174
lib : bool ,
174
175
bins : FilterRule < ' a > ,
175
176
examples : FilterRule < ' a > ,
@@ -389,13 +390,15 @@ impl<'a> CompileFilter<'a> {
389
390
390
391
if all_targets {
391
392
CompileFilter :: Only {
393
+ all_targets : true ,
392
394
lib : true , bins : FilterRule :: All ,
393
395
examples : FilterRule :: All , benches : FilterRule :: All ,
394
396
tests : FilterRule :: All ,
395
397
}
396
398
} else if lib_only || rule_bins. is_specific ( ) || rule_tsts. is_specific ( )
397
399
|| rule_exms. is_specific ( ) || rule_bens. is_specific ( ) {
398
400
CompileFilter :: Only {
401
+ all_targets : false ,
399
402
lib : lib_only, bins : rule_bins,
400
403
examples : rule_exms, benches : rule_bens,
401
404
tests : rule_tsts,
@@ -410,7 +413,7 @@ impl<'a> CompileFilter<'a> {
410
413
pub fn matches ( & self , target : & Target ) -> bool {
411
414
match * self {
412
415
CompileFilter :: Default { .. } => true ,
413
- CompileFilter :: Only { lib, bins, examples, tests, benches } => {
416
+ CompileFilter :: Only { lib, bins, examples, tests, benches, .. } => {
414
417
let rule = match * target. kind ( ) {
415
418
TargetKind :: Bin => bins,
416
419
TargetKind :: Test => tests,
@@ -637,7 +640,7 @@ fn generate_targets<'a>(pkg: &'a Package,
637
640
} ;
638
641
generate_auto_targets ( mode, pkg. targets ( ) , profile, deps, required_features_filterable)
639
642
}
640
- CompileFilter :: Only { lib, bins, examples, tests, benches } => {
643
+ CompileFilter :: Only { all_targets , lib, bins, examples, tests, benches } => {
641
644
let mut targets = Vec :: new ( ) ;
642
645
643
646
if lib {
@@ -647,7 +650,7 @@ fn generate_targets<'a>(pkg: &'a Package,
647
650
profile : profile,
648
651
required : true ,
649
652
} ) ;
650
- } else {
653
+ } else if !all_targets {
651
654
bail ! ( "no library targets found" )
652
655
}
653
656
}
0 commit comments