]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/reallocate-change-alloc.rs
properly check for: double-free, use-after-reallocate
[rust.git] / tests / compile-fail / reallocate-change-alloc.rs
1 #![feature(alloc, heap_api)]
2
3 extern crate alloc;
4
5 use alloc::heap::*;
6 fn main() {
7     unsafe {
8         let x = allocate(1, 1);
9         let _y = reallocate(x, 1, 1, 1);
10         let _z = *x; //~ ERROR: dangling pointer was dereferenced
11     }
12 }