rust/tests/compile-fail/deallocate-bad-size.rs
Tim Diekmann 3d8bf92a11
Rename Alloc to AllocRef
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.
2020-01-29 04:10:33 +01:00

16 lines
386 B
Rust

#![feature(allocator_api)]
extern crate alloc;
use alloc::alloc::Global;
use std::alloc::{AllocRef, Layout};
// error-pattern: incorrect alloc info: expected size 2 and align 1, got size 1 and align 1
fn main() {
unsafe {
let x = Global.alloc(Layout::from_size_align_unchecked(1, 1)).unwrap();
Global.dealloc(x, Layout::from_size_align_unchecked(2, 1));
}
}