Skip to content

Commit b2410ff

Browse files
committed
Unwind safety
1 parent 53b4f98 commit b2410ff

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/lib.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use std::{
99
marker::PhantomData,
1010
mem::{ManuallyDrop, MaybeUninit},
1111
ops::{Deref, DerefMut},
12+
panic::{RefUnwindSafe, UnwindSafe},
1213
ptr::{addr_eq, null_mut, slice_from_raw_parts, slice_from_raw_parts_mut, NonNull},
1314
sync::atomic::{AtomicUsize, Ordering::*},
1415
};
@@ -85,12 +86,19 @@ pub struct VecBelt<T> {
8586
tail: UnsafeCell<NonNull<Fragment<T>>>,
8687
}
8788

88-
/// Safety: [`VecBelt<T>`] provides synchronization primitives that won't lead to data races.
89+
/// # Safety
90+
///
91+
/// [`VecBelt<T>`] provides synchronization primitives that won't lead to data races.
8992
unsafe impl<T: Send> Send for VecBelt<T> {}
90-
/// Safety: `T: Sync` isn't necessary here, because there is guaranteed not to be references to the
91-
/// same elements across threads.
93+
/// # Safety
94+
///
95+
/// `T: Sync` isn't necessary here, because there is guaranteed not to be references to the same
96+
/// elements across threads.
9297
unsafe impl<T: Send> Sync for VecBelt<T> {}
9398

99+
impl<T> UnwindSafe for VecBelt<T> {}
100+
impl<T> RefUnwindSafe for VecBelt<T> {}
101+
94102
impl<T> VecBelt<T> {
95103
/// Creates a new [`VecBelt<T>`], preallocating a fragment of the given initial size.
96104
#[inline]

0 commit comments

Comments
 (0)