Skip to content

Commit bd91877

Browse files
authored
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 🤷‍♂️
2 parents 6968b75 + ed1439c commit bd91877

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

library/std/src/lazy.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,9 @@ unsafe impl<T, F: Send> Sync for SyncLazy<T, F> where SyncOnceCell<T>: Sync {}
451451
// auto-derived `Send` impl is OK.
452452

453453
#[unstable(feature = "once_cell", issue = "74465")]
454-
impl<T, F: RefUnwindSafe> RefUnwindSafe for SyncLazy<T, F> where SyncOnceCell<T>: RefUnwindSafe {}
454+
impl<T, F: UnwindSafe> RefUnwindSafe for SyncLazy<T, F> where SyncOnceCell<T>: RefUnwindSafe {}
455+
#[unstable(feature = "once_cell", issue = "74465")]
456+
impl<T, F: UnwindSafe> UnwindSafe for SyncLazy<T, F> where SyncOnceCell<T>: UnwindSafe {}
455457

456458
impl<T, F> SyncLazy<T, F> {
457459
/// Creates a new lazy value with the given initializing

0 commit comments

Comments
 (0)