Add const_unchecked_layout test to libcore/tests

This commit is contained in:
Richard Wiedenhöft 2019-04-30 08:23:14 +02:00
parent a7a05203f1
commit 07e8d84479
2 changed files with 12 additions and 0 deletions

View file

@ -0,0 +1,10 @@
use core::alloc::Layout;
#[test]
fn const_unchecked_layout() {
const SIZE: usize = 0x2000;
const ALIGN: usize = 0x1000;
const LAYOUT: Layout = unsafe { Layout::from_size_align_unchecked(SIZE, ALIGN) };
assert_eq!(LAYOUT.size(), SIZE);
assert_eq!(LAYOUT.align(), ALIGN);
}

View file

@ -31,10 +31,12 @@
#![feature(slice_partition_dedup)]
#![feature(copy_within)]
#![feature(int_error_matching)]
#![feature(const_fn)]
#![warn(rust_2018_idioms)]
extern crate test;
mod alloc;
mod any;
mod array;
mod ascii;