Commit f8a080e4 authored by ticki's avatar ticki

Fix documentation for wrong use of `Guard::new`.

parent 27b8c62e
......@@ -106,7 +106,8 @@ impl<T: ?Sized> Guard<T> {
/// It is very important that this closure does not contain anything which might cause a
/// garbage collection, as garbage collecting inside this closure will cause the current thread
/// to be blocked infinitely (because the hazard is blocked) and stop all other threads from
/// collecting garbage, leading to memory leaks in those.
/// collecting garbage, leading to memory leaks in those — unless it is compiled in debug mode,
/// in which case it will likely panic.
pub fn new<F>(ptr: F) -> Guard<T>
where F: FnOnce() -> &'static T {
Guard::try_new::<_, ()>(|| Ok(ptr())).unwrap()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment