about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMark Simulacrum <mark.simulacrum@gmail.com>2018-04-01 18:04:57 +0200
committerGitHub <noreply@github.com>2018-04-01 18:04:57 +0200
commit36f9f76356b3c2eb12bb3090c6c1349be8593333 (patch)
tree83b9f310edae4d92016c2f2ad72612446e918a12 /src
parent4799d2eb0121bbc21fc9da70015ced663f6cfc72 (diff)
parent86915ddf308bf4e4d4cb17fe0b2d7f12cd591328 (diff)
downloadrust-36f9f76356b3c2eb12bb3090c6c1349be8593333.tar.gz
rust-36f9f76356b3c2eb12bb3090c6c1349be8593333.zip
Rollup merge of #49549 - Mark-Simulacrum:bootstrap-cleanup, r=alexcrichton
Remove filetime dep from build_helper

r? @alexcrichton
Diffstat (limited to 'src')
-rw-r--r--src/Cargo.lock3
-rw-r--r--src/bootstrap/compile.rs2
-rw-r--r--src/build_helper/Cargo.toml3
-rw-r--r--src/build_helper/lib.rs19
4 files changed, 8 insertions, 19 deletions
diff --git a/src/Cargo.lock b/src/Cargo.lock
index 398609db457..8729335faba 100644
--- a/src/Cargo.lock
+++ b/src/Cargo.lock
@@ -152,9 +152,6 @@ dependencies = [
 [[package]]
 name = "build_helper"
 version = "0.1.0"
-dependencies = [
- "filetime 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
-]
 
 [[package]]
 name = "byteorder"
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 9f33935b6e9..e6aa78fba52 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -1120,7 +1120,7 @@ pub fn run_cargo(build: &Build, cargo: &mut Command, stamp: &Path, is_check: boo
     let max = max.unwrap();
     let max_path = max_path.unwrap();
     if stamp_contents == new_contents && max <= stamp_mtime {
-        build.verbose(&format!("not updating {:?}; contents equal and {} <= {}",
+        build.verbose(&format!("not updating {:?}; contents equal and {:?} <= {:?}",
                 stamp, max, stamp_mtime));
         return deps
     }
diff --git a/src/build_helper/Cargo.toml b/src/build_helper/Cargo.toml
index f8ade0616a5..01d704f816b 100644
--- a/src/build_helper/Cargo.toml
+++ b/src/build_helper/Cargo.toml
@@ -6,6 +6,3 @@ authors = ["The Rust Project Developers"]
 [lib]
 name = "build_helper"
 path = "lib.rs"
-
-[dependencies]
-filetime = "0.1"
diff --git a/src/build_helper/lib.rs b/src/build_helper/lib.rs
index 363bbd79544..5a12afd03e1 100644
--- a/src/build_helper/lib.rs
+++ b/src/build_helper/lib.rs
@@ -10,14 +10,11 @@
 
 #![deny(warnings)]
 
-extern crate filetime;
-
 use std::fs::File;
 use std::path::{Path, PathBuf};
 use std::process::{Command, Stdio};
 use std::{fs, env};
-
-use filetime::FileTime;
+use std::time::{SystemTime, UNIX_EPOCH};
 
 /// A helper macro to `unwrap` a result except also print out details like:
 ///
@@ -137,10 +134,8 @@ pub fn rerun_if_changed_anything_in_dir(dir: &Path) {
 }
 
 /// Returns the last-modified time for `path`, or zero if it doesn't exist.
-pub fn mtime(path: &Path) -> FileTime {
-    fs::metadata(path).map(|f| {
-        FileTime::from_last_modification_time(&f)
-    }).unwrap_or(FileTime::zero())
+pub fn mtime(path: &Path) -> SystemTime {
+    fs::metadata(path).and_then(|f| f.modified()).unwrap_or(UNIX_EPOCH)
 }
 
 /// Returns whether `dst` is up to date given that the file or files in `src`
@@ -157,9 +152,9 @@ pub fn up_to_date(src: &Path, dst: &Path) -> bool {
         Err(e) => panic!("source {:?} failed to get metadata: {}", src, e),
     };
     if meta.is_dir() {
-        dir_up_to_date(src, &threshold)
+        dir_up_to_date(src, threshold)
     } else {
-        FileTime::from_last_modification_time(&meta) <= threshold
+        meta.modified().unwrap_or(UNIX_EPOCH) <= threshold
     }
 }
 
@@ -226,13 +221,13 @@ pub fn sanitizer_lib_boilerplate(sanitizer_name: &str) -> Result<NativeLibBoiler
                            search_path)
 }
 
-fn dir_up_to_date(src: &Path, threshold: &FileTime) -> bool {
+fn dir_up_to_date(src: &Path, threshold: SystemTime) -> bool {
     t!(fs::read_dir(src)).map(|e| t!(e)).all(|e| {
         let meta = t!(e.metadata());
         if meta.is_dir() {
             dir_up_to_date(&e.path(), threshold)
         } else {
-            FileTime::from_last_modification_time(&meta) < *threshold
+            meta.modified().unwrap_or(UNIX_EPOCH) < threshold
         }
     })
 }