]> git.lizzy.rs Git - rust.git/blob - src/tools/miri/tests/fail/alloc/reallocate-change-alloc.rs
Auto merge of #100865 - compiler-errors:parent-substs-still, r=cjgillot
[rust.git] / src / tools / miri / tests / fail / alloc / 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         let _y = realloc(x, Layout::from_size_align_unchecked(1, 1), 1);
7         let _z = *x; //~ ERROR: dereferenced after this allocation got freed
8     }
9 }