未验证 提交 0bb06cbe 编写于 作者: M Mazdak Farrokhzad 提交者: GitHub

Rollup merge of #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
......@@ -298,15 +298,3 @@ pub fn new(_p: &Path, _wait: bool, _create: bool, _exclusive: bool)
}
}
}
impl Lock {
pub fn panicking_new(p: &Path,
wait: bool,
create: bool,
exclusive: bool)
-> Lock {
Lock::new(p, wait, create, exclusive).unwrap_or_else(|err| {
panic!("could not lock `{}`: {}", p.display(), err);
})
}
}
......@@ -546,7 +546,8 @@ fn write_shared(
// Write out the shared files. Note that these are shared among all rustdoc
// docs placed in the output directory, so this needs to be a synchronized
// operation with respect to all other rustdocs running around.
let _lock = flock::Lock::panicking_new(&cx.dst.join(".lock"), true, true, true);
let lock_file = cx.dst.join(".lock");
let _lock = try_err!(flock::Lock::new(&lock_file, true, true, true), &lock_file);
// Add all the static files. These may already exist, but we just
// overwrite them anyway to make sure that they're fresh and up-to-date.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册