Skip to content

Commit 0417b39

Browse files
committed
actually test with slice instead of array
Without the as_slice call, the value passed to from_ptr was &[i32; 5] which is *not* a slice.
1 parent 96a77ac commit 0417b39

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/addr.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,10 @@ mod tests {
823823
fn test_from_ptr_array() {
824824
let slice = &[1, 2, 3, 4, 5];
825825
// Make sure that from_ptr(slice) is the address of the first element
826-
assert_eq!(VirtAddr::from_ptr(slice), VirtAddr::from_ptr(&slice[0]));
826+
assert_eq!(
827+
VirtAddr::from_ptr(slice.as_slice()),
828+
VirtAddr::from_ptr(&slice[0])
829+
);
827830
}
828831
}
829832

0 commit comments

Comments
 (0)