|
1 | 1 | #![feature(box_syntax)]
|
2 |
| -#![feature(allocator_api)] |
3 |
| - |
4 |
| -use std::alloc::{Global, Alloc, Layout, System}; |
5 | 2 |
|
6 | 3 | fn make_box() -> Box<(i16, i16)> {
|
7 | 4 | Box::new((1, 2))
|
@@ -30,31 +27,8 @@ fn allocate_reallocate() {
|
30 | 27 | assert_eq!(s.capacity(), 9);
|
31 | 28 | }
|
32 | 29 |
|
33 |
| -fn check_overalign_requests<T: Alloc>(mut allocator: T) { |
34 |
| - let size = 8; |
35 |
| - let align = 16; // greater than size |
36 |
| - let iterations = 1; // Miri is deterministic, no need to try many times |
37 |
| - unsafe { |
38 |
| - let pointers: Vec<_> = (0..iterations).map(|_| { |
39 |
| - allocator.alloc(Layout::from_size_align(size, align).unwrap()).unwrap() |
40 |
| - }).collect(); |
41 |
| - for &ptr in &pointers { |
42 |
| - assert_eq!((ptr.as_ptr() as usize) % align, 0, |
43 |
| - "Got a pointer less aligned than requested") |
44 |
| - } |
45 |
| - |
46 |
| - // Clean up |
47 |
| - for &ptr in &pointers { |
48 |
| - allocator.dealloc(ptr, Layout::from_size_align(size, align).unwrap()) |
49 |
| - } |
50 |
| - } |
51 |
| -} |
52 |
| - |
53 | 30 | fn main() {
|
54 | 31 | assert_eq!(*make_box(), (1, 2));
|
55 | 32 | assert_eq!(*make_box_syntax(), (1, 2));
|
56 | 33 | allocate_reallocate();
|
57 |
| - |
58 |
| - check_overalign_requests(System); |
59 |
| - check_overalign_requests(Global); |
60 | 34 | }
|
0 commit comments