2019-02-28 00:32:13 -06:00
|
|
|
// run-pass
|
|
|
|
|
2019-06-08 05:30:52 -05:00
|
|
|
#![feature(ptr_internals, test)]
|
|
|
|
|
|
|
|
extern crate test;
|
|
|
|
use test::black_box as b; // prevent promotion of the argument and const-propagation of the result
|
2019-02-28 00:32:13 -06:00
|
|
|
|
|
|
|
use std::ptr::Unique;
|
|
|
|
|
|
|
|
|
2020-04-30 04:00:45 -05:00
|
|
|
const PTR: *mut u32 = Unique::dangling().as_ptr();
|
2019-02-28 00:32:13 -06:00
|
|
|
|
|
|
|
pub fn main() {
|
2019-06-08 13:35:59 -05:00
|
|
|
// Be super-extra paranoid and cast the fn items to fn pointers before blackboxing them.
|
2020-04-30 04:00:45 -05:00
|
|
|
assert_eq!(PTR, b::<fn() -> _>(Unique::<u32>::dangling)().as_ptr());
|
2019-02-28 00:32:13 -06:00
|
|
|
}
|