Skip to content

Commit b582436

Browse files
committed
Address potential future UB by only using raw pointers
rust-lang/unsafe-code-guidelines#346
1 parent b6d96ca commit b582436

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/raw/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,11 +1329,11 @@ impl<T, A: Allocator> RawTable<T, A> {
13291329
) -> [Option<*mut T>; N] {
13301330
// TODO use `MaybeUninit::uninit_array` here instead once that's stable.
13311331
let mut outs: MaybeUninit<[Option<*mut T>; N]> = MaybeUninit::uninit();
1332-
let outs_ptr = outs.as_mut_ptr();
1332+
let outs_ptr = outs.as_mut_ptr() as *mut Option<*mut T>;
13331333

13341334
for (i, &hash) in hashes.iter().enumerate() {
13351335
let cur = self.find(hash, |k| eq(i, k)).map(|cur| cur.as_ptr());
1336-
*(*outs_ptr).get_unchecked_mut(i) = cur;
1336+
outs_ptr.add(i).write(cur);
13371337
}
13381338

13391339
outs.assume_init()

0 commit comments

Comments
 (0)