Skip to content

Commit

Permalink
Update mod.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
sffc authored Dec 23, 2023
1 parent 08af4f0 commit d479642
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions utils/zerovec/src/zerovec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,9 @@ where
/// backing buffer
#[inline]
pub const fn new_borrowed(slice: &'a [T::ULE]) -> Self {
// Note: there is an impl From<&T> for NonNull<T> but it is not const
let slice = unsafe { NonNull::new_unchecked(slice as *const [T::ULE] as *mut [T::ULE]) };
// Safety: references in Rust cannot be null.
// The safe function `impl From<&T> for NonNull<T>` is not const.
let slice = unsafe { NonNull::new_unchecked(slice as *const [_] as *mut [_]) };
Self {
vector: EyepatchHackVector {
buf: slice,
Expand Down

0 comments on commit d479642

Please sign in to comment.