@@ -669,15 +669,6 @@ fn stamp(config: &Config, testpaths: &TestPaths, revision: Option<&str>) -> Path
669
669
output_base_dir ( config, testpaths, revision) . join ( "stamp" )
670
670
}
671
671
672
- /// Return an iterator over timestamps of files in the directory at `path`.
673
- fn collect_timestamps ( path : & PathBuf ) -> impl Iterator < Item =FileTime > {
674
- WalkDir :: new ( path)
675
- . into_iter ( )
676
- . map ( |entry| entry. unwrap ( ) )
677
- . filter ( |entry| entry. file_type ( ) . is_file ( ) )
678
- . map ( |entry| mtime ( entry. path ( ) ) )
679
- }
680
-
681
672
fn up_to_date (
682
673
config : & Config ,
683
674
testpaths : & TestPaths ,
@@ -700,13 +691,15 @@ fn up_to_date(
700
691
let rust_src_dir = config
701
692
. find_rust_src_root ( )
702
693
. expect ( "Could not find Rust source root" ) ;
703
- let stamp = mtime ( & stamp_name) ;
704
- let mut inputs = vec ! [ mtime ( & testpaths. file) , mtime ( & config. rustc_path) ] ;
694
+ let stamp = Stamp :: from_path ( & stamp_name) ;
695
+ let mut inputs = vec ! [ Stamp :: from_path ( & testpaths. file) , Stamp :: from_path ( & config. rustc_path) ] ;
705
696
inputs. extend (
706
697
props
707
698
. aux
708
699
. iter ( )
709
- . map ( |aux| mtime ( & testpaths. file . parent ( ) . unwrap ( ) . join ( "auxiliary" ) . join ( aux) ) ) ,
700
+ . map ( |aux| {
701
+ Stamp :: from_path ( & testpaths. file . parent ( ) . unwrap ( ) . join ( "auxiliary" ) . join ( aux) )
702
+ } ) ,
710
703
) ;
711
704
// Relevant pretty printer files
712
705
let pretty_printer_files = [
@@ -717,24 +710,47 @@ fn up_to_date(
717
710
"src/etc/lldb_rust_formatters.py" ,
718
711
] ;
719
712
inputs. extend ( pretty_printer_files. iter ( ) . map ( |pretty_printer_file| {
720
- mtime ( & rust_src_dir. join ( pretty_printer_file) )
713
+ Stamp :: from_path ( & rust_src_dir. join ( pretty_printer_file) )
721
714
} ) ) ;
722
- inputs. extend ( collect_timestamps ( & config. run_lib_path ) ) ;
715
+ inputs. extend ( Stamp :: from_dir ( & config. run_lib_path ) ) ;
723
716
if let Some ( ref rustdoc_path) = config. rustdoc_path {
724
- inputs. push ( mtime ( & rustdoc_path) ) ;
725
- inputs. push ( mtime ( & rust_src_dir. join ( "src/etc/htmldocck.py" ) ) ) ;
717
+ inputs. push ( Stamp :: from_path ( & rustdoc_path) ) ;
718
+ inputs. push ( Stamp :: from_path ( & rust_src_dir. join ( "src/etc/htmldocck.py" ) ) ) ;
726
719
}
727
720
728
721
// UI test files.
729
722
inputs. extend ( UI_EXTENSIONS . iter ( ) . map ( |extension| {
730
723
let path = & expected_output_path ( testpaths, revision, & config. compare_mode , extension) ;
731
- mtime ( path)
724
+ Stamp :: from_path ( path)
732
725
} ) ) ;
733
726
734
727
// Compiletest itself.
735
- inputs. extend ( collect_timestamps ( & rust_src_dir. join ( "src/tools/compiletest/" ) ) ) ;
728
+ inputs. extend ( Stamp :: from_dir ( & rust_src_dir. join ( "src/tools/compiletest/" ) ) ) ;
736
729
737
- inputs. iter ( ) . any ( |input| * input > stamp)
730
+ inputs. iter ( ) . any ( |input| input > & stamp)
731
+ }
732
+
733
+ #[ derive( Debug , PartialEq , PartialOrd , Ord , Eq ) ]
734
+ struct Stamp {
735
+ time : FileTime ,
736
+ file : PathBuf ,
737
+ }
738
+
739
+ impl Stamp {
740
+ fn from_path ( p : & Path ) -> Self {
741
+ Stamp {
742
+ time : mtime ( & p) ,
743
+ file : p. into ( ) ,
744
+ }
745
+ }
746
+
747
+ fn from_dir ( path : & Path ) -> impl Iterator < Item =Stamp > {
748
+ WalkDir :: new ( path)
749
+ . into_iter ( )
750
+ . map ( |entry| entry. unwrap ( ) )
751
+ . filter ( |entry| entry. file_type ( ) . is_file ( ) )
752
+ . map ( |entry| Stamp :: from_path ( entry. path ( ) ) )
753
+ }
738
754
}
739
755
740
756
fn mtime ( path : & Path ) -> FileTime {
0 commit comments