]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/reallocate-bad-size.rs
Auto merge of #1308 - RalfJung:miri, r=RalfJung
[rust.git] / tests / compile-fail / reallocate-bad-size.rs
1 use std::alloc::{alloc, realloc, Layout};
2
3 // error-pattern: allocation has size 1 and alignment 1, but gave size 2 and alignment 1
4
5 fn main() {
6     unsafe {
7         let x = alloc(Layout::from_size_align_unchecked(1, 1));
8         realloc(x, Layout::from_size_align_unchecked(2, 1), 1);
9     }
10 }