2019-08-30 07:30:59 +00:00
|
|
|
//@ check-pass
|
2024-02-22 13:59:52 +00:00
|
|
|
//
|
2018-10-03 07:06:35 +00:00
|
|
|
// Some constants that *are* valid
|
2024-02-22 13:59:52 +00:00
|
|
|
#![feature(generic_nonzero)]
|
2018-10-03 07:06:35 +00:00
|
|
|
|
|
|
|
use std::mem;
|
|
|
|
use std::ptr::NonNull;
|
2024-02-22 13:59:52 +00:00
|
|
|
use std::num::NonZero;
|
2018-10-03 07:06:35 +00:00
|
|
|
|
|
|
|
const NON_NULL_PTR1: NonNull<u8> = unsafe { mem::transmute(1usize) };
|
|
|
|
const NON_NULL_PTR2: NonNull<u8> = unsafe { mem::transmute(&0) };
|
|
|
|
|
2024-02-22 13:59:52 +00:00
|
|
|
const NON_NULL_U8: NonZero<u8> = unsafe { mem::transmute(1u8) };
|
|
|
|
const NON_NULL_USIZE: NonZero<usize> = unsafe { mem::transmute(1usize) };
|
2018-10-03 07:06:35 +00:00
|
|
|
|
|
|
|
const UNIT: () = ();
|
|
|
|
|
|
|
|
fn main() {}
|