]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/alloc/reallocate-change-alloc.rs
organize compile-fail tests in folders
[rust.git] / tests / compile-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         realloc(x, Layout::from_size_align_unchecked(1, 1), 1);
7         let _z = *x; //~ ERROR dereferenced after this allocation got freed
8     }
9 }