]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/dangling-alloc-id-ice.rs
Rollup merge of #72279 - RalfJung:raw-ref-macros, r=nikomatsakis
[rust.git] / src / test / ui / consts / dangling-alloc-id-ice.rs
1 // https://github.com/rust-lang/rust/issues/55223
2 #![allow(const_err)]
3
4 union Foo<'a> {
5     y: &'a (),
6     long_live_the_unit: &'static (),
7 }
8
9 const FOO: &() = { //~ ERROR it is undefined behavior to use this value
10 //~^ ERROR encountered dangling pointer in final constant
11     let y = ();
12     unsafe { Foo { y: &y }.long_live_the_unit }
13 };
14
15 fn main() {}