Skip to content

Commit f76a340

Browse files
committed
Auto merge of #387 - stepancheg:data-start-non-null, r=Amanieu
Mark RawTable::data_start NonNull For consistency with `RawTable::data_end` which is `NonNull`.
2 parents 59c0e15 + f347aea commit f76a340

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/raw/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -937,8 +937,8 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
937937
/// Returns pointer to start of data table.
938938
#[inline]
939939
#[cfg(any(feature = "raw", feature = "nightly"))]
940-
pub unsafe fn data_start(&self) -> *mut T {
941-
self.data_end().as_ptr().wrapping_sub(self.buckets())
940+
pub unsafe fn data_start(&self) -> NonNull<T> {
941+
NonNull::new_unchecked(self.data_end().as_ptr().wrapping_sub(self.buckets()))
942942
}
943943

944944
/// Return the information about memory allocated by the table.
@@ -2572,7 +2572,8 @@ impl<T: Copy, A: Allocator + Clone> RawTableClone for RawTable<T, A> {
25722572
.copy_to_nonoverlapping(self.table.ctrl(0), self.table.num_ctrl_bytes());
25732573
source
25742574
.data_start()
2575-
.copy_to_nonoverlapping(self.data_start(), self.table.buckets());
2575+
.as_ptr()
2576+
.copy_to_nonoverlapping(self.data_start().as_ptr(), self.table.buckets());
25762577

25772578
self.table.items = source.table.items;
25782579
self.table.growth_left = source.table.growth_left;

0 commit comments

Comments
 (0)