Skip to content

Commit 0bb06cb

Browse files
authored
Rollup merge of rust-lang#66657 - ollie27:rustdoc_flock_panic, r=GuillaumeGomez
rustdoc: Don't panic when failing to write .lock file It can be treated like any other unexpected IO error. I couldn't think of a good way to add a test for this unfortunately. r? @GuillaumeGomez
2 parents 8ad3b5c + 05ef20f commit 0bb06cb

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

Diff for: src/librustc_data_structures/flock.rs

-12
Original file line numberDiff line numberDiff line change
@@ -298,15 +298,3 @@ cfg_if! {
298298
}
299299
}
300300
}
301-
302-
impl Lock {
303-
pub fn panicking_new(p: &Path,
304-
wait: bool,
305-
create: bool,
306-
exclusive: bool)
307-
-> Lock {
308-
Lock::new(p, wait, create, exclusive).unwrap_or_else(|err| {
309-
panic!("could not lock `{}`: {}", p.display(), err);
310-
})
311-
}
312-
}

Diff for: src/librustdoc/html/render.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,8 @@ fn write_shared(
546546
// Write out the shared files. Note that these are shared among all rustdoc
547547
// docs placed in the output directory, so this needs to be a synchronized
548548
// operation with respect to all other rustdocs running around.
549-
let _lock = flock::Lock::panicking_new(&cx.dst.join(".lock"), true, true, true);
549+
let lock_file = cx.dst.join(".lock");
550+
let _lock = try_err!(flock::Lock::new(&lock_file, true, true, true), &lock_file);
550551

551552
// Add all the static files. These may already exist, but we just
552553
// overwrite them anyway to make sure that they're fresh and up-to-date.

0 commit comments

Comments
 (0)