We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
core::ptr
1 parent 52f0d00 commit 4d7adacCopy full SHA for 4d7adac
1 file changed
coretests/tests/ptr.rs
@@ -489,6 +489,14 @@ fn is_aligned() {
489
assert_ne!(ptr.is_aligned_to(8), ptr.wrapping_add(1).is_aligned_to(8));
490
}
491
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
+
500
#[test]
501
fn offset_from() {
502
let mut a = [0; 5];
0 commit comments