Skip to content

Commit 7238734

Browse files
committed
Fix the Send and Sync implementations
1 parent 07f3055 commit 7238734

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ impl<T, const N: usize, #[cfg(feature = "allocator_api")] A: Allocator> alloc_pa
628628
// Ensure capacity growth is exponential.
629629
let new_capacity = new_capacity.max(2 * old_capacity);
630630

631-
// SAFETY: The stored capacity corresponds always to a valid layout.
631+
// SAFETY: The stored capacity always corresponds to a valid layout.
632632
let old_layout = unsafe { array_layout_unchecked::<T>(old_capacity) };
633633

634634
let new_layout = Layout::array::<T>(new_capacity).map_err(|_| CollectionAllocErr::CapacityOverflow)?;
@@ -686,7 +686,7 @@ impl<T, const N: usize, #[cfg(feature = "allocator_api")] A: Allocator> alloc_pa
686686
return Ok(true);
687687
}
688688

689-
// SAFETY: The stored capacity corresponds always to a valid layout.
689+
// SAFETY: The stored capacity always corresponds to a valid layout.
690690
let old_layout = unsafe { array_layout_unchecked::<T>(old_capacity) };
691691

692692
let new_layout = Layout::array::<T>(new_capacity).map_err(|_| CollectionAllocErr::CapacityOverflow)?;
@@ -813,8 +813,8 @@ pub struct SmallVec<T, const N: usize, #[cfg(feature = "allocator_api")] A: Allo
813813
_marker: PhantomData<T>,
814814
}
815815

816-
unsafe impl<T: Send, const N: usize, #[cfg(feature = "allocator_api")] A: Allocator> Send for alloc_param!(SmallVec<T, N, A>) {}
817-
unsafe impl<T: Sync, const N: usize, #[cfg(feature = "allocator_api")] A: Allocator> Sync for alloc_param!(SmallVec<T, N, A>) {}
816+
unsafe impl<T: Send, const N: usize, #[cfg(feature = "allocator_api")] A: Send> Send for alloc_param!(SmallVec<T, N, A>) {}
817+
unsafe impl<T: Sync, const N: usize, #[cfg(feature = "allocator_api")] A: Sync> Sync for alloc_param!(SmallVec<T, N, A>) {}
818818

819819
impl<T, const N: usize> Default for SmallVec<T, N> {
820820
#[inline]
@@ -1198,8 +1198,8 @@ pub struct IntoIter<T, const N: usize, #[cfg(feature = "allocator_api")] A: Allo
11981198

11991199
// SAFETY: IntoIter has unique ownership of its contents. Sending (or sharing) an `IntoIter<T, N>`
12001200
// is equivalent to sending (or sharing) a `SmallVec<T, N>`.
1201-
unsafe impl<T, const N: usize, #[cfg(feature = "allocator_api")] A: Allocator> Send for alloc_param!(IntoIter<T, N, A>) where T: Send {}
1202-
unsafe impl<T, const N: usize, #[cfg(feature = "allocator_api")] A: Allocator> Sync for alloc_param!(IntoIter<T, N, A>) where T: Sync {}
1201+
unsafe impl<T, const N: usize, #[cfg(feature = "allocator_api")] A: Send> Send for alloc_param!(IntoIter<T, N, A>) where T: Send {}
1202+
unsafe impl<T, const N: usize, #[cfg(feature = "allocator_api")] A: Sync> Sync for alloc_param!(IntoIter<T, N, A>) where T: Sync {}
12031203

12041204
impl<T, const N: usize, #[cfg(feature = "allocator_api")] A: Allocator> alloc_param!(IntoIter<T, N, A>) {
12051205
#[inline]

0 commit comments

Comments
 (0)