3d8bf92a11
Required to land https://github.com/rust-lang/rust/pull/68529. Please see that PR for details. The CI is expected to fail until the PR is landed.
17 lines
417 B
Rust
17 lines
417 B
Rust
#![feature(allocator_api)]
|
|
|
|
extern crate alloc;
|
|
|
|
use alloc::alloc::Global;
|
|
use std::alloc::{AllocRef, Layout};
|
|
|
|
// error-pattern: tried to deallocate dangling pointer
|
|
|
|
fn main() {
|
|
unsafe {
|
|
let x = Global.alloc(Layout::from_size_align_unchecked(1, 1)).unwrap();
|
|
Global.dealloc(x, Layout::from_size_align_unchecked(1, 1));
|
|
Global.dealloc(x, Layout::from_size_align_unchecked(1, 1));
|
|
}
|
|
}
|