diff --git a/Cargo.lock b/Cargo.lock index 982070a243ee5..b6dc3bdb89bd4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -459,7 +459,6 @@ version = "0.0.0" dependencies = [ "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml index 336d7e32024b7..e759ad1f35dde 100644 --- a/src/tools/compiletest/Cargo.toml +++ b/src/tools/compiletest/Cargo.toml @@ -7,7 +7,6 @@ edition = "2018" [dependencies] diff = "0.1.10" env_logger = { version = "0.5", default-features = false } -filetime = "0.2" getopts = "0.2" log = "0.4" regex = "1.0" diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index e253934e566a7..442e58bfd74e1 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -9,7 +9,6 @@ use crate::common::CompareMode; use crate::common::{expected_output_path, output_base_dir, output_relative_path, UI_EXTENSIONS}; use crate::common::{Config, TestPaths}; use crate::common::{DebugInfoBoth, DebugInfoGdb, DebugInfoLldb, Mode, Pretty}; -use filetime::FileTime; use getopts::Options; use std::env; use std::ffi::OsString; @@ -17,6 +16,7 @@ use std::fs; use std::io::{self, ErrorKind}; use std::path::{Path, PathBuf}; use std::process::Command; +use std::time::SystemTime; use test::ColorConfig; use crate::util::logv; use walkdir::WalkDir; @@ -752,31 +752,36 @@ fn up_to_date( #[derive(Debug, PartialEq, PartialOrd, Ord, Eq)] struct Stamp { - time: FileTime, + time: SystemTime, file: PathBuf, } impl Stamp { fn from_path(p: &Path) -> Self { + let time = fs::metadata(p) + .and_then(|metadata| metadata.modified()) + .unwrap_or(SystemTime::UNIX_EPOCH); + Stamp { - time: mtime(&p), + time, file: p.into(), } } - fn from_dir(path: &Path) -> impl Iterator { + fn from_dir(path: &Path) -> impl Iterator { WalkDir::new(path) .into_iter() .map(|entry| entry.unwrap()) .filter(|entry| entry.file_type().is_file()) - .map(|entry| Stamp::from_path(entry.path())) - } -} + .map(|entry| { + let time = (|| -> io::Result<_> { entry.metadata()?.modified() })(); -fn mtime(path: &Path) -> FileTime { - fs::metadata(path) - .map(|f| FileTime::from_last_modification_time(&f)) - .unwrap_or_else(|_| FileTime::zero()) + Stamp { + time: time.unwrap_or(SystemTime::UNIX_EPOCH), + file: entry.path().into(), + } + }) + } } fn make_test_name( diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 10b8133326bba..22c2f0a05379b 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -9,7 +9,6 @@ use crate::common::{Config, TestPaths}; use crate::common::{Incremental, MirOpt, RunMake, Ui, JsDocTest, Assembly}; use diff; use crate::errors::{self, Error, ErrorKind}; -use filetime::FileTime; use crate::header::TestProps; use crate::json; use regex::{Captures, Regex}; @@ -3032,7 +3031,7 @@ impl<'test> TestCx<'test> { } fn check_mir_test_timestamp(&self, test_name: &str, output_file: &Path) { - let t = |file| FileTime::from_last_modification_time(&fs::metadata(file).unwrap()); + let t = |file| fs::metadata(file).unwrap().modified().unwrap(); let source_file = &self.testpaths.file; let output_time = t(output_file); let source_time = t(source_file);