3 #![feature(ptr_internals, test)]
6 use test::black_box as b; // prevent promotion of the argument and const-propagation of the result
10 const DANGLING: NonNull<u32> = NonNull::dangling();
11 const CASTED: NonNull<u32> = NonNull::cast(NonNull::<i32>::dangling());
14 assert_eq!(DANGLING, b(NonNull::dangling()));
15 assert_eq!(CASTED, b(NonNull::dangling()));