rust/tests/ui/consts/dangling-alloc-id-ice.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
289 B
Rust
Raw Normal View History

// https://github.com/rust-lang/rust/issues/55223
union Foo<'a> {
y: &'a (),
long_live_the_unit: &'static (),
}
2020-11-05 07:54:21 +00:00
const FOO: &() = {
//~^ ERROR encountered dangling pointer in final value of constant
let y = ();
unsafe { Foo { y: &y }.long_live_the_unit }
};
fn main() {}