]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/dangling-alloc-id-ice.rs
Rollup merge of #106962 - compiler-errors:use-sugg-span, r=oli-obk
[rust.git] / tests / ui / consts / dangling-alloc-id-ice.rs
1 // https://github.com/rust-lang/rust/issues/55223
2
3 union Foo<'a> {
4     y: &'a (),
5     long_live_the_unit: &'static (),
6 }
7
8 const FOO: &() = {
9 //~^ ERROR encountered dangling pointer in final constant
10     let y = ();
11     unsafe { Foo { y: &y }.long_live_the_unit }
12 };
13
14 fn main() {}