]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/deallocate-twice.rs
67312b0d96ddac13e670d216d89a1208afbc6a39
[rust.git] / tests / compile-fail / deallocate-twice.rs
1 use std::alloc::{alloc, dealloc, Layout};
2
3 // error-pattern: dereferenced after this allocation got freed
4
5 fn main() {
6     unsafe {
7         let x = alloc(Layout::from_size_align_unchecked(1, 1));
8         dealloc(x, Layout::from_size_align_unchecked(1, 1));
9         dealloc(x, Layout::from_size_align_unchecked(1, 1));
10     }
11 }