]> git.proxmox.com Git - rustc.git/blame - src/test/ui/consts/min_const_fn/min_const_fn_unsafe_bad.rs
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / src / test / ui / consts / min_const_fn / min_const_fn_unsafe_bad.rs
CommitLineData
3dfed10e 1const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } }
e1599b0c
XL
2//~^ dereferencing raw pointers in constant functions
3
4const unsafe fn bad_const_unsafe_deref_raw(x: *mut usize) -> usize { *x }
5//~^ dereferencing raw pointers in constant functions
6
7const unsafe fn bad_const_unsafe_deref_raw_ref(x: *mut usize) -> &'static usize { &*x }
8//~^ dereferencing raw pointers in constant functions
9
10fn main() {}
11
12const unsafe fn no_union() {
13 union Foo { x: (), y: () }
14 Foo { x: () }.y
1b1a35ee 15 //~^ unions in const fn
e1599b0c 16}