Skip to content

Commit 6857a14

Browse files
committed
fix: fix Rust debug builds
The tests were failing with: thread 'test_repl' (67668) panicked at src/filters.rs:531:22: unsafe precondition(s) violated: slice::from_raw_parts requires the pointer to be aligned and non-null, and the total size of the slice not to exceed `isize::MAX` This commit replaces the unsafe code with safe code.
1 parent 9591704 commit 6857a14

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/filters.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -527,9 +527,12 @@ impl<'a> BboxFilter<'a> {
527527

528528
/// Function to deserialize the Arraypaths
529529
fn from_u8_slice(slice: &[u8]) -> Vec<u64> {
530-
let u64_slice =
531-
unsafe { std::slice::from_raw_parts(slice.as_ptr() as *const u64, slice.len() / 8) };
532-
u64_slice.to_vec()
530+
slice
531+
.as_chunks::<8>()
532+
.0
533+
.iter()
534+
.map(|chunk| u64::from_ne_bytes(*chunk))
535+
.collect()
533536
}
534537
}
535538

0 commit comments

Comments
 (0)