2019-02-28 06:32:13 +00:00
|
|
|
// run-pass
|
|
|
|
|
2019-06-08 10:30:52 +00: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 06:32:13 +00:00
|
|
|
|
|
|
|
use std::ptr::Unique;
|
|
|
|
|
|
|
|
|
2020-04-30 09:00:45 +00:00
|
|
|
const PTR: *mut u32 = Unique::dangling().as_ptr();
|
2019-02-28 06:32:13 +00:00
|
|
|
|
|
|
|
pub fn main() {
|
2019-06-08 18:35:59 +00:00
|
|
|
// Be super-extra paranoid and cast the fn items to fn pointers before blackboxing them.
|
2020-04-30 09:00:45 +00:00
|
|
|
assert_eq!(PTR, b::<fn() -> _>(Unique::<u32>::dangling)().as_ptr());
|
2019-02-28 06:32:13 +00:00
|
|
|
}
|