about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-07-29 09:24:19 +0900
committerGitHub <noreply@github.com>2020-07-29 09:24:19 +0900
commitbd918776361ad94dcb483aef47b585d4c130001c (patch)
tree9cfafd52690f47dde36c15d50f18790992bc17e2
parent6968b75bd0524915d3fcf6b201b41827d4695603 (diff)
parented1439cea48144dcdfee84ccd8d7b0d0edb9f64e (diff)
downloadrust-bd918776361ad94dcb483aef47b585d4c130001c.tar.gz
rust-bd918776361ad94dcb483aef47b585d4c130001c.zip
Rollup merge of #74814 - matklad:unwind-safe, r=KodrAus
Fix RefUnwindSafe & UnwinsSafe impls for lazy::SyncLazy

I *think* we should implement those unconditionally with respect to `F`.

The user code can't observe the closure in any way, and we poison lazy if the closure itself panics.

But I've never fully wrapped my head around `UnwindSafe` traits, so :man_shrugging:
-rw-r--r--library/std/src/lazy.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/library/std/src/lazy.rs b/library/std/src/lazy.rs
index 1705a4f77c5..60eba96bcc0 100644
--- a/library/std/src/lazy.rs
+++ b/library/std/src/lazy.rs
@@ -451,7 +451,9 @@ unsafe impl<T, F: Send> Sync for SyncLazy<T, F> where SyncOnceCell<T>: Sync {}
 // auto-derived `Send` impl is OK.
 
 #[unstable(feature = "once_cell", issue = "74465")]
-impl<T, F: RefUnwindSafe> RefUnwindSafe for SyncLazy<T, F> where SyncOnceCell<T>: RefUnwindSafe {}
+impl<T, F: UnwindSafe> RefUnwindSafe for SyncLazy<T, F> where SyncOnceCell<T>: RefUnwindSafe {}
+#[unstable(feature = "once_cell", issue = "74465")]
+impl<T, F: UnwindSafe> UnwindSafe for SyncLazy<T, F> where SyncOnceCell<T>: UnwindSafe {}
 
 impl<T, F> SyncLazy<T, F> {
     /// Creates a new lazy value with the given initializing