Skip to content

Commit 87ae4db

Browse files
committed
Improve core::ptr coverage
1 parent a171994 commit 87ae4db

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

library/coretests/tests/ptr.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,14 @@ fn is_aligned() {
489489
assert_ne!(ptr.is_aligned_to(8), ptr.wrapping_add(1).is_aligned_to(8));
490490
}
491491

492+
#[test]
493+
#[should_panic = "is_aligned_to: align is not a power-of-two"]
494+
fn invalid_is_aligned() {
495+
let data = 42;
496+
let ptr: *const i32 = &data;
497+
assert!(ptr.is_aligned_to(3));
498+
}
499+
492500
#[test]
493501
fn offset_from() {
494502
let mut a = [0; 5];

0 commit comments

Comments
 (0)