]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/deallocate-twice.rs
Auto merge of #1308 - RalfJung:miri, r=RalfJung
[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 }