From d47964268d37410fe2e742713b6f49a1c9379f41 Mon Sep 17 00:00:00 2001 From: "Shane F. Carr" Date: Sat, 23 Dec 2023 14:10:50 -0800 Subject: [PATCH] Update mod.rs --- utils/zerovec/src/zerovec/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/zerovec/src/zerovec/mod.rs b/utils/zerovec/src/zerovec/mod.rs index 771615c55f2..5f5667ceada 100644 --- a/utils/zerovec/src/zerovec/mod.rs +++ b/utils/zerovec/src/zerovec/mod.rs @@ -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 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` is not const. + let slice = unsafe { NonNull::new_unchecked(slice as *const [_] as *mut [_]) }; Self { vector: EyepatchHackVector { buf: slice,