]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/alloc/deallocate-bad-alignment.rs
organize compile-fail tests in folders
[rust.git] / tests / compile-fail / alloc / deallocate-bad-alignment.rs
1 use std::alloc::{alloc, dealloc, Layout};
2
3 // error-pattern: allocation has size 1 and alignment 1, but gave size 1 and alignment 2
4
5 fn main() {
6     unsafe {
7         let x = alloc(Layout::from_size_align_unchecked(1, 1));
8         dealloc(x, Layout::from_size_align_unchecked(1, 2));
9     }
10 }