@@ -71,7 +71,8 @@ pub struct Builder<'a> {
7171 /// executed to be logged instead. Used by snapshot tests of command-line
7272 /// paths-to-steps handling.
7373 #[ expect( clippy:: type_complexity) ]
74- log_cli_step_for_tests : Option < Box < dyn Fn ( & StepDescription , & [ PathSet ] , & [ TargetSelection ] ) > > ,
74+ log_cli_step_for_tests :
75+ Option < Box < dyn Fn ( & StepDescription , & [ StepSelectors ] , & [ TargetSelection ] ) > > ,
7576}
7677
7778impl Deref for Builder < ' _ > {
@@ -242,7 +243,7 @@ impl StepMetadata {
242243pub struct RunConfig < ' a > {
243244 pub builder : & ' a Builder < ' a > ,
244245 pub target : TargetSelection ,
245- pub paths : Vec < PathSet > ,
246+ pub paths : Vec < StepSelectors > ,
246247}
247248
248249impl RunConfig < ' _ > {
@@ -349,7 +350,7 @@ impl Debug for StepSelection {
349350
350351/// Collection of paths used to match a task rule.
351352#[ derive( Debug , Clone , PartialOrd , Ord , PartialEq , Eq ) ]
352- pub enum PathSet {
353+ pub enum StepSelectors {
353354 /// A collection of individual paths or aliases.
354355 ///
355356 /// These are generally matched as a path suffix. For example, a
@@ -370,21 +371,21 @@ pub enum PathSet {
370371 TestSuite ( StepSelection ) ,
371372}
372373
373- impl PathSet {
374- fn empty ( ) -> PathSet {
375- PathSet :: Set ( BTreeSet :: new ( ) )
374+ impl StepSelectors {
375+ fn empty ( ) -> StepSelectors {
376+ StepSelectors :: Set ( BTreeSet :: new ( ) )
376377 }
377378
378- fn one < P : Into < PathBuf > > ( path : P , kind : Kind ) -> PathSet {
379+ fn one < P : Into < PathBuf > > ( path : P , kind : Kind ) -> StepSelectors {
379380 let mut set = BTreeSet :: new ( ) ;
380381 set. insert ( StepSelection { path : path. into ( ) , kind : Some ( kind) } ) ;
381- PathSet :: Set ( set)
382+ StepSelectors :: Set ( set)
382383 }
383384
384385 fn has ( & self , needle : & Path , module : Kind ) -> bool {
385386 match self {
386- PathSet :: Set ( set) => set. iter ( ) . any ( |p| Self :: check ( p, needle, module) ) ,
387- PathSet :: TestSuite ( suite) => Self :: check ( suite, needle, module) ,
387+ StepSelectors :: Set ( set) => set. iter ( ) . any ( |p| Self :: check ( p, needle, module) ) ,
388+ StepSelectors :: TestSuite ( suite) => Self :: check ( suite, needle, module) ,
388389 }
389390 }
390391
@@ -403,7 +404,7 @@ impl PathSet {
403404 /// This is used for `StepDescription::krate`, which passes all matching crates at once to
404405 /// `Step::make_run`, rather than calling it many times with a single crate.
405406 /// See `tests.rs` for examples.
406- fn intersection_removing_matches ( & self , needles : & mut [ CLIStepPath ] , module : Kind ) -> PathSet {
407+ fn intersection_removing_matches ( & self , needles : & mut [ CLIStepPath ] , module : Kind ) -> StepSelectors {
407408 let mut check = |p| {
408409 let mut result = false ;
409410 for n in needles. iter_mut ( ) {
@@ -416,12 +417,12 @@ impl PathSet {
416417 result
417418 } ;
418419 match self {
419- PathSet :: Set ( set) => PathSet :: Set ( set. iter ( ) . filter ( |& p| check ( p) ) . cloned ( ) . collect ( ) ) ,
420- PathSet :: TestSuite ( suite) => {
420+ StepSelectors :: Set ( set) => StepSelectors :: Set ( set. iter ( ) . filter ( |& p| check ( p) ) . cloned ( ) . collect ( ) ) ,
421+ StepSelectors :: TestSuite ( suite) => {
421422 if check ( suite) {
422423 self . clone ( )
423424 } else {
424- PathSet :: empty ( )
425+ StepSelectors :: empty ( )
425426 }
426427 }
427428 }
@@ -433,11 +434,11 @@ impl PathSet {
433434 #[ track_caller]
434435 pub fn assert_single_path ( & self ) -> & StepSelection {
435436 match self {
436- PathSet :: Set ( set) => {
437+ StepSelectors :: Set ( set) => {
437438 assert_eq ! ( set. len( ) , 1 , "called assert_single_path on multiple paths" ) ;
438439 set. iter ( ) . next ( ) . unwrap ( )
439440 }
440- PathSet :: TestSuite ( _) => unreachable ! ( "called assert_single_path on a Suite path" ) ,
441+ StepSelectors :: TestSuite ( _) => unreachable ! ( "called assert_single_path on a Suite path" ) ,
441442 }
442443 }
443444}
@@ -454,7 +455,7 @@ impl StepDescription {
454455 }
455456 }
456457
457- fn maybe_run ( & self , builder : & Builder < ' _ > , mut pathsets : Vec < PathSet > ) {
458+ fn maybe_run ( & self , builder : & Builder < ' _ > , mut pathsets : Vec < StepSelectors > ) {
458459 pathsets. retain ( |set| !self . is_excluded ( builder, set) ) ;
459460
460461 if pathsets. is_empty ( ) {
@@ -477,7 +478,7 @@ impl StepDescription {
477478 }
478479 }
479480
480- fn is_excluded ( & self , builder : & Builder < ' _ > , pathset : & PathSet ) -> bool {
481+ fn is_excluded ( & self , builder : & Builder < ' _ > , pathset : & StepSelectors ) -> bool {
481482 if builder. config . skip . iter ( ) . any ( |e| pathset. has ( e, builder. kind ) ) {
482483 if !matches ! ( builder. config. get_dry_run( ) , DryRun :: SelfCheck ) {
483484 println ! ( "Skipping {pathset:?} because it is excluded" ) ;
@@ -510,7 +511,7 @@ pub struct ShouldRun<'a> {
510511 kind : Kind ,
511512
512513 // use a BTreeSet to maintain sort order
513- paths : BTreeSet < PathSet > ,
514+ paths : BTreeSet < StepSelectors > ,
514515}
515516
516517impl < ' a > ShouldRun < ' a > {
@@ -535,7 +536,7 @@ impl<'a> ShouldRun<'a> {
535536 pub ( crate ) fn crates ( mut self , crates : Vec < & Crate > ) -> Self {
536537 for krate in crates {
537538 let path = krate. local_path ( self . builder ) ;
538- self . paths . insert ( PathSet :: one ( path, self . kind ) ) ;
539+ self . paths . insert ( StepSelectors :: one ( path, self . kind ) ) ;
539540 }
540541 self
541542 }
@@ -549,7 +550,7 @@ impl<'a> ShouldRun<'a> {
549550 self . kind == Kind :: Setup || !self . builder. src. join( alias) . exists( ) ,
550551 "use `builder.path()` for real paths: {alias}"
551552 ) ;
552- self . paths . insert ( PathSet :: Set (
553+ self . paths . insert ( StepSelectors :: Set (
553554 std:: iter:: once ( StepSelection { path : alias. into ( ) , kind : Some ( self . kind ) } ) . collect ( ) ,
554555 ) ) ;
555556 self
@@ -574,7 +575,7 @@ impl<'a> ShouldRun<'a> {
574575 pub fn paths ( mut self , paths : & [ & str ] ) -> Self {
575576 let submodules_paths = self . builder . submodule_paths ( ) ;
576577
577- self . paths . insert ( PathSet :: Set (
578+ self . paths . insert ( StepSelectors :: Set (
578579 paths
579580 . iter ( )
580581 . map ( |p| {
@@ -594,21 +595,21 @@ impl<'a> ShouldRun<'a> {
594595 }
595596
596597 /// Handles individual files (not directories) within a test suite.
597- fn is_suite_path ( & self , requested_path : & Path ) -> Option < & PathSet > {
598+ fn is_suite_path ( & self , requested_path : & Path ) -> Option < & StepSelectors > {
598599 self . paths . iter ( ) . find ( |pathset| match pathset {
599- PathSet :: TestSuite ( suite) => requested_path. starts_with ( & suite. path ) ,
600- PathSet :: Set ( _) => false ,
600+ StepSelectors :: TestSuite ( suite) => requested_path. starts_with ( & suite. path ) ,
601+ StepSelectors :: Set ( _) => false ,
601602 } )
602603 }
603604
604605 pub fn suite_path ( mut self , suite : & str ) -> Self {
605- self . paths . insert ( PathSet :: TestSuite ( StepSelection { path : suite. into ( ) , kind : Some ( self . kind ) } ) ) ;
606+ self . paths . insert ( StepSelectors :: TestSuite ( StepSelection { path : suite. into ( ) , kind : Some ( self . kind ) } ) ) ;
606607 self
607608 }
608609
609610 // allows being more explicit about why should_run in Step returns the value passed to it
610611 pub fn never ( mut self ) -> ShouldRun < ' a > {
611- self . paths . insert ( PathSet :: empty ( ) ) ;
612+ self . paths . insert ( StepSelectors :: empty ( ) ) ;
612613 self
613614 }
614615
@@ -625,11 +626,11 @@ impl<'a> ShouldRun<'a> {
625626 & self ,
626627 paths : & mut [ CLIStepPath ] ,
627628 kind : Kind ,
628- ) -> Vec < PathSet > {
629+ ) -> Vec < StepSelectors > {
629630 let mut sets = vec ! [ ] ;
630631 for pathset in & self . paths {
631632 let subset = pathset. intersection_removing_matches ( paths, kind) ;
632- if subset != PathSet :: empty ( ) {
633+ if subset != StepSelectors :: empty ( ) {
633634 sets. push ( subset) ;
634635 }
635636 }
@@ -1062,12 +1063,12 @@ impl<'a> Builder<'a> {
10621063 } ;
10631064 for pathset in should_run. paths {
10641065 match pathset {
1065- PathSet :: Set ( set) => {
1066+ StepSelectors :: Set ( set) => {
10661067 for path in set {
10671068 add_path ( & path. path ) ;
10681069 }
10691070 }
1070- PathSet :: TestSuite ( path) => {
1071+ StepSelectors :: TestSuite ( path) => {
10711072 add_path ( & path. path . join ( "..." ) ) ;
10721073 }
10731074 }
@@ -1653,7 +1654,7 @@ Alternatively, you can set `build.local-rebuild=true` and use a stage0 compiler
16531654 if should_run. paths . iter ( ) . any ( |s| s. has ( path, desc. kind ) )
16541655 && !desc. is_excluded (
16551656 self ,
1656- & PathSet :: TestSuite ( StepSelection { path : path. clone ( ) , kind : Some ( desc. kind ) } ) ,
1657+ & StepSelectors :: TestSuite ( StepSelection { path : path. clone ( ) , kind : Some ( desc. kind ) } ) ,
16571658 )
16581659 {
16591660 return true ;
0 commit comments