diff options
| author | Richard Wiedenhöft <richard@wiedenhoeft.xyz> | 2019-04-30 08:23:14 +0200 |
|---|---|---|
| committer | Richard Wiedenhöft <richard@wiedenhoeft.xyz> | 2019-05-14 09:41:50 +0200 |
| commit | 07e8d844795628ce90415c1dec3536f3e75cc71c (patch) | |
| tree | 32bf24e10c07deef098f2b32d73b46861da917d6 | |
| parent | a7a05203f18eac663ebf2751b77621c453dc280c (diff) | |
| download | rust-07e8d844795628ce90415c1dec3536f3e75cc71c.tar.gz rust-07e8d844795628ce90415c1dec3536f3e75cc71c.zip | |
Add const_unchecked_layout test to libcore/tests
| -rw-r--r-- | src/libcore/tests/alloc.rs | 10 | ||||
| -rw-r--r-- | src/libcore/tests/lib.rs | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/libcore/tests/alloc.rs b/src/libcore/tests/alloc.rs new file mode 100644 index 00000000000..63537ba23d8 --- /dev/null +++ b/src/libcore/tests/alloc.rs @@ -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); +} diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index b8075ef2942..c617596aba8 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -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; |
