]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/deallocate-twice.rs
properly check for: double-free, use-after-reallocate
[rust.git] / tests / compile-fail / deallocate-twice.rs
1 #![feature(alloc, heap_api)]
2
3 extern crate alloc;
4
5 // error-pattern: tried to deallocate with a pointer not to the beginning of an existing object
6
7 use alloc::heap::*;
8 fn main() {
9     unsafe {
10         let x = allocate(1, 1);
11         deallocate(x, 1, 1);
12         deallocate(x, 1, 1);
13     }
14 }