2019-08-30 09:30:59 +02:00
|
|
|
// check-pass
|
2018-10-03 09:06:35 +02:00
|
|
|
|
|
|
|
// Some constants that *are* valid
|
2019-08-30 09:30:59 +02:00
|
|
|
#![deny(const_err)]
|
2018-10-03 09:06:35 +02:00
|
|
|
|
|
|
|
use std::mem;
|
|
|
|
use std::ptr::NonNull;
|
|
|
|
use std::num::{NonZeroU8, NonZeroUsize};
|
|
|
|
|
|
|
|
const NON_NULL_PTR1: NonNull<u8> = unsafe { mem::transmute(1usize) };
|
|
|
|
const NON_NULL_PTR2: NonNull<u8> = unsafe { mem::transmute(&0) };
|
|
|
|
|
|
|
|
const NON_NULL_U8: NonZeroU8 = unsafe { mem::transmute(1u8) };
|
|
|
|
const NON_NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(1usize) };
|
|
|
|
|
|
|
|
const UNIT: () = ();
|
|
|
|
|
|
|
|
fn main() {}
|