mirror of
https://forge.sourceware.org/marek/gcc.git
synced 2026-02-22 20:01:31 -05:00
This commit imports libcore 1.49.0 into a new directory, "libgrust/rustc-lib/core". LICENSE-* files are taken from the rustc 1.49.0 repository root. libgrust/ChangeLog: * rustc-lib/LICENSE-APACHE: New file. * rustc-lib/LICENSE-MIT: New file. * rustc-lib/version-info: New file. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
14 lines
434 B
Rust
14 lines
434 B
Rust
use core::alloc::Layout;
|
|
use core::ptr::NonNull;
|
|
|
|
#[test]
|
|
fn const_unchecked_layout() {
|
|
const SIZE: usize = 0x2000;
|
|
const ALIGN: usize = 0x1000;
|
|
const LAYOUT: Layout = unsafe { Layout::from_size_align_unchecked(SIZE, ALIGN) };
|
|
const DANGLING: NonNull<u8> = LAYOUT.dangling();
|
|
assert_eq!(LAYOUT.size(), SIZE);
|
|
assert_eq!(LAYOUT.align(), ALIGN);
|
|
assert_eq!(Some(DANGLING), NonNull::new(ALIGN as *mut u8));
|
|
}
|