diff options
| author | Christian Poveda <christian.poveda@ferrous-systems.com> | 2025-09-12 14:41:26 -0500 |
|---|---|---|
| committer | Christian Poveda <christian.poveda@ferrous-systems.com> | 2025-09-12 14:41:26 -0500 |
| commit | 87ae4dbf5cc1e81db845c659583aa489d532ae8c (patch) | |
| tree | bb9fd684789320ce5ecccb17893fb525fdbbb0e6 | |
| parent | a171994070dc18c3a32fc1aa2d98cf03ae96b63e (diff) | |
Improve `core::ptr` coverage
| -rw-r--r-- | library/coretests/tests/ptr.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/library/coretests/tests/ptr.rs b/library/coretests/tests/ptr.rs index f8774833d0a..4d5138d539b 100644 --- a/library/coretests/tests/ptr.rs +++ b/library/coretests/tests/ptr.rs @@ -490,6 +490,14 @@ fn is_aligned() { } #[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]; let ptr1: *mut i32 = &mut a[1]; |
