@@ -170,6 +170,7 @@ pub enum CompileFilter<'a> {
170170 required_features_filterable : bool ,
171171 } ,
172172 Only {
173+ all_targets : bool ,
173174 lib : bool ,
174175 bins : FilterRule < ' a > ,
175176 examples : FilterRule < ' a > ,
@@ -389,13 +390,15 @@ impl<'a> CompileFilter<'a> {
389390
390391 if all_targets {
391392 CompileFilter :: Only {
393+ all_targets : true ,
392394 lib : true , bins : FilterRule :: All ,
393395 examples : FilterRule :: All , benches : FilterRule :: All ,
394396 tests : FilterRule :: All ,
395397 }
396398 } else if lib_only || rule_bins. is_specific ( ) || rule_tsts. is_specific ( )
397399 || rule_exms. is_specific ( ) || rule_bens. is_specific ( ) {
398400 CompileFilter :: Only {
401+ all_targets : false ,
399402 lib : lib_only, bins : rule_bins,
400403 examples : rule_exms, benches : rule_bens,
401404 tests : rule_tsts,
@@ -410,7 +413,7 @@ impl<'a> CompileFilter<'a> {
410413 pub fn matches ( & self , target : & Target ) -> bool {
411414 match * self {
412415 CompileFilter :: Default { .. } => true ,
413- CompileFilter :: Only { lib, bins, examples, tests, benches } => {
416+ CompileFilter :: Only { lib, bins, examples, tests, benches, .. } => {
414417 let rule = match * target. kind ( ) {
415418 TargetKind :: Bin => bins,
416419 TargetKind :: Test => tests,
@@ -637,7 +640,7 @@ fn generate_targets<'a>(pkg: &'a Package,
637640 } ;
638641 generate_auto_targets ( mode, pkg. targets ( ) , profile, deps, required_features_filterable)
639642 }
640- CompileFilter :: Only { lib, bins, examples, tests, benches } => {
643+ CompileFilter :: Only { all_targets , lib, bins, examples, tests, benches } => {
641644 let mut targets = Vec :: new ( ) ;
642645
643646 if lib {
@@ -647,7 +650,7 @@ fn generate_targets<'a>(pkg: &'a Package,
647650 profile : profile,
648651 required : true ,
649652 } ) ;
650- } else {
653+ } else if !all_targets {
651654 bail ! ( "no library targets found" )
652655 }
653656 }
0 commit comments