Add const_unchecked_layout test to libcore/tests
This commit is contained in:
parent
a7a05203f1
commit
07e8d84479
2 changed files with 12 additions and 0 deletions
10
src/libcore/tests/alloc.rs
Normal file
10
src/libcore/tests/alloc.rs
Normal 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);
|
||||
}
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue