Skip to content

Commit be6081b

Browse files
committed
Improve core::alloc coverage
1 parent 76c5ed2 commit be6081b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

library/coretests/tests/alloc.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ fn layout_array_edge_cases() {
5555
}
5656
}
5757

58+
#[test]
59+
fn layout_errors() {
60+
let layout = Layout::new::<[u8; 2]>();
61+
assert!(layout.align_to(isize::MAX as usize + 1).is_err());
62+
assert!(layout.align_to(3).is_err());
63+
assert!(layout.repeat(usize::MAX).is_err());
64+
assert!(layout.repeat_packed(usize::MAX).is_err());
65+
66+
let next = Layout::from_size_align(isize::MAX as usize, 1).unwrap();
67+
assert!(layout.extend(next).is_err());
68+
}
69+
5870
#[test]
5971
fn layout_debug_shows_log2_of_alignment() {
6072
// `Debug` is not stable, but here's what it does right now

0 commit comments

Comments
 (0)