Skip to content

File tree

4 files changed

+8
-19
lines changed

4 files changed

+8
-19
lines changed
 

‎src/Cargo.lock

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/bootstrap/compile.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,7 @@ pub fn run_cargo(build: &Build, cargo: &mut Command, stamp: &Path, is_check: boo
11201120
let max = max.unwrap();
11211121
let max_path = max_path.unwrap();
11221122
if stamp_contents == new_contents && max <= stamp_mtime {
1123-
build.verbose(&format!("not updating {:?}; contents equal and {} <= {}",
1123+
build.verbose(&format!("not updating {:?}; contents equal and {:?} <= {:?}",
11241124
stamp, max, stamp_mtime));
11251125
return deps
11261126
}

‎src/build_helper/Cargo.toml

-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,3 @@ authors = ["The Rust Project Developers"]
66
[lib]
77
name = "build_helper"
88
path = "lib.rs"
9-
10-
[dependencies]
11-
filetime = "0.1"

‎src/build_helper/lib.rs

+7-12
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@
1010

1111
#![deny(warnings)]
1212

13-
extern crate filetime;
14-
1513
use std::fs::File;
1614
use std::path::{Path, PathBuf};
1715
use std::process::{Command, Stdio};
1816
use std::{fs, env};
19-
20-
use filetime::FileTime;
17+
use std::time::{SystemTime, UNIX_EPOCH};
2118

2219
/// A helper macro to `unwrap` a result except also print out details like:
2320
///
@@ -137,10 +134,8 @@ pub fn rerun_if_changed_anything_in_dir(dir: &Path) {
137134
}
138135

139136
/// Returns the last-modified time for `path`, or zero if it doesn't exist.
140-
pub fn mtime(path: &Path) -> FileTime {
141-
fs::metadata(path).map(|f| {
142-
FileTime::from_last_modification_time(&f)
143-
}).unwrap_or(FileTime::zero())
137+
pub fn mtime(path: &Path) -> SystemTime {
138+
fs::metadata(path).and_then(|f| f.modified()).unwrap_or(UNIX_EPOCH)
144139
}
145140

146141
/// 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 {
157152
Err(e) => panic!("source {:?} failed to get metadata: {}", src, e),
158153
};
159154
if meta.is_dir() {
160-
dir_up_to_date(src, &threshold)
155+
dir_up_to_date(src, threshold)
161156
} else {
162-
FileTime::from_last_modification_time(&meta) <= threshold
157+
meta.modified().unwrap_or(UNIX_EPOCH) <= threshold
163158
}
164159
}
165160

@@ -226,13 +221,13 @@ pub fn sanitizer_lib_boilerplate(sanitizer_name: &str) -> Result<NativeLibBoiler
226221
search_path)
227222
}
228223

229-
fn dir_up_to_date(src: &Path, threshold: &FileTime) -> bool {
224+
fn dir_up_to_date(src: &Path, threshold: SystemTime) -> bool {
230225
t!(fs::read_dir(src)).map(|e| t!(e)).all(|e| {
231226
let meta = t!(e.metadata());
232227
if meta.is_dir() {
233228
dir_up_to_date(&e.path(), threshold)
234229
} else {
235-
FileTime::from_last_modification_time(&meta) < *threshold
230+
meta.modified().unwrap_or(UNIX_EPOCH) < threshold
236231
}
237232
})
238233
}

0 commit comments

Comments
 (0)
Please sign in to comment.