]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/deallocate-bad-size.rs
fix warnings in tests; update validation whitelist
[rust.git] / tests / compile-fail / deallocate-bad-size.rs
1 #![feature(alloc, allocator_api)]
2
3 extern crate alloc;
4
5 use alloc::heap::Heap;
6 use alloc::allocator::*;
7
8 // error-pattern: tried to deallocate or reallocate using incorrect alignment or size
9
10 fn main() {
11     unsafe {
12         let x = Heap.alloc(Layout::from_size_align_unchecked(1, 1)).unwrap();
13         Heap.dealloc(x, Layout::from_size_align_unchecked(2, 1));
14     }
15 }