]> git.proxmox.com Git - rustc.git/blame - src/test/ui/consts/const-ptr-unique-rpass.rs
New upstream version 1.49.0+dfsg1
[rustc.git] / src / test / ui / consts / const-ptr-unique-rpass.rs
CommitLineData
532ac7d7
XL
1// run-pass
2
dc9dc135
XL
3#![feature(ptr_internals, test)]
4
5extern crate test;
6use test::black_box as b; // prevent promotion of the argument and const-propagation of the result
532ac7d7
XL
7
8use std::ptr::Unique;
9
532ac7d7 10
72b1a166 11const PTR: *mut u32 = Unique::dangling().as_ptr();
532ac7d7
XL
12
13pub fn main() {
dc9dc135 14 // Be super-extra paranoid and cast the fn items to fn pointers before blackboxing them.
72b1a166 15 assert_eq!(PTR, b::<fn() -> _>(Unique::<u32>::dangling)().as_ptr());
532ac7d7 16}