Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions library/coretests/tests/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
Loading