Skip to content

Commit

Permalink
actually test with slice instead of array
Browse files Browse the repository at this point in the history
Without the as_slice call, the value passed to from_ptr was &[i32; 5]
which is *not* a slice.
  • Loading branch information
Freax13 committed Nov 24, 2024
1 parent b9e3d25 commit 3d65714
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,10 @@ mod tests {
fn test_from_ptr_array() {
let slice = &[1, 2, 3, 4, 5];
// Make sure that from_ptr(slice) is the address of the first element
assert_eq!(VirtAddr::from_ptr(slice), VirtAddr::from_ptr(&slice[0]));
assert_eq!(
VirtAddr::from_ptr(slice.as_slice()),
VirtAddr::from_ptr(&slice[0])
);
}
}

Expand Down

0 comments on commit 3d65714

Please sign in to comment.