Skip to content

Commit

Permalink
Add const_unchecked_layout test to libcore/tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard-W committed May 14, 2019
1 parent a7a0520 commit 07e8d84
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/libcore/tests/alloc.rs
Original file line number Diff line number Diff line change
@@ -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);
}
2 changes: 2 additions & 0 deletions src/libcore/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 07e8d84

Please sign in to comment.