about summary refs log tree commit diff
path: root/src/tools/miri/tests/fail/alloc/deallocate-bad-size.rs
blob: d818f3a9304ee8a6de5f9ca8ad9d9b77cd69dc8b (plain)
1
2
3
4
5
6
7
8
use std::alloc::{Layout, alloc, dealloc};

fn main() {
    unsafe {
        let x = alloc(Layout::from_size_align_unchecked(1, 1));
        dealloc(x, Layout::from_size_align_unchecked(2, 1)); //~ERROR: has size 1 and alignment 1, but gave size 2 and alignment 1
    }
}