@@ -669,15 +669,6 @@ fn stamp(config: &Config, testpaths: &TestPaths, revision: Option<&str>) -> Path
669669 output_base_dir ( config, testpaths, revision) . join ( "stamp" )
670670}
671671
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-
681672fn up_to_date (
682673 config : & Config ,
683674 testpaths : & TestPaths ,
@@ -700,13 +691,15 @@ fn up_to_date(
700691 let rust_src_dir = config
701692 . find_rust_src_root ( )
702693 . 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) ] ;
705696 inputs. extend (
706697 props
707698 . aux
708699 . 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+ } ) ,
710703 ) ;
711704 // Relevant pretty printer files
712705 let pretty_printer_files = [
@@ -717,24 +710,47 @@ fn up_to_date(
717710 "src/etc/lldb_rust_formatters.py" ,
718711 ] ;
719712 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) )
721714 } ) ) ;
722- inputs. extend ( collect_timestamps ( & config. run_lib_path ) ) ;
715+ inputs. extend ( Stamp :: from_dir ( & config. run_lib_path ) ) ;
723716 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" ) ) ) ;
726719 }
727720
728721 // UI test files.
729722 inputs. extend ( UI_EXTENSIONS . iter ( ) . map ( |extension| {
730723 let path = & expected_output_path ( testpaths, revision, & config. compare_mode , extension) ;
731- mtime ( path)
724+ Stamp :: from_path ( path)
732725 } ) ) ;
733726
734727 // 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/" ) ) ) ;
736729
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+ }
738754}
739755
740756fn mtime ( path : & Path ) -> FileTime {
0 commit comments