summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/dangling-alloc-id-ice.rs
blob: d591bfc731ce43bd39fe144da7f005b4df476fcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// https://github.com/rust-lang/rust/issues/55223

union Foo<'a> {
    y: &'a (),
    long_live_the_unit: &'static (),
}

const FOO: &() = {
//~^ ERROR encountered dangling pointer in final constant
    let y = ();
    unsafe { Foo { y: &y }.long_live_the_unit }
};

fn main() {}