Rollup merge of #146488 - ferrocene:pvdrz/improve-ptr-coverage, r=Mark-Simulacrum
Improve `core::ptr` coverage This PR improves the `core::ptr` coverage by adding a new test to `coretests` for the `<*const T>::is_aligned_to` method. r? libs
This commit is contained in:
commit
32c045ecd1
1 changed files with 8 additions and 0 deletions
|
|
@ -489,6 +489,14 @@ fn is_aligned() {
|
|||
assert_ne!(ptr.is_aligned_to(8), ptr.wrapping_add(1).is_aligned_to(8));
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic = "is_aligned_to: align is not a power-of-two"]
|
||||
fn invalid_is_aligned() {
|
||||
let data = 42;
|
||||
let ptr: *const i32 = &data;
|
||||
assert!(ptr.is_aligned_to(3));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn offset_from() {
|
||||
let mut a = [0; 5];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue