]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/reallocate-change-alloc.rs
Auto merge of #1308 - RalfJung:miri, r=RalfJung
[rust.git] / tests / compile-fail / reallocate-change-alloc.rs
1 use std::alloc::{alloc, realloc, Layout};
2
3 fn main() {
4     unsafe {
5         let x = alloc(Layout::from_size_align_unchecked(1, 1));
6         realloc(x, Layout::from_size_align_unchecked(1, 1), 1);
7         let _z = *x; //~ ERROR dereferenced after this allocation got freed
8     }
9 }