Bug 1368083 - Better bindgen error message when files are missing. r=emilio
This is only slightly more informative because it doesn't give
the filename, but I think it's an improvement on the simple
unwrap() panic when we try to read a file which isn't there.
MozReview-Commit-ID: HseYZ48TUrF
--- a/servo/components/style/build_gecko.rs
+++ b/servo/components/style/build_gecko.rs
@@ -128,17 +128,18 @@ mod bindings {
.expect("Failed to get modified time of executable"));
}
fn get_modified_time(file: &Path) -> Option<SystemTime> {
file.metadata().and_then(|m| m.modified()).ok()
}
fn update_last_modified(file: &Path) {
- let modified = get_modified_time(file).unwrap();
+ let modified = get_modified_time(file)
+ .expect("Couldn't get file modification time");
let mut last_modified = LAST_MODIFIED.lock().unwrap();
*last_modified = cmp::max(modified, *last_modified);
}
fn search_include(name: &str) -> Option<PathBuf> {
for path in SEARCH_PATHS.iter() {
let file = path.join(name);
if file.is_file() {