]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/reallocate-bad-size.rs
Auto merge of #1205 - RalfJung:serde, r=RalfJung
[rust.git] / tests / compile-fail / reallocate-bad-size.rs
1 #![feature(allocator_api)]
2
3 extern crate alloc;
4
5 use alloc::alloc::Global;
6 use std::alloc::{AllocRef, Layout};
7
8 // error-pattern: incorrect alloc info: expected size 2 and align 1, got size 1 and align 1
9
10 fn main() {
11     unsafe {
12         let x = Global.alloc(Layout::from_size_align_unchecked(1, 1)).unwrap().0;
13         Global.realloc(x, Layout::from_size_align_unchecked(2, 1), 1).unwrap();
14     }
15 }