summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/dangling-alloc-id-ice.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/consts/dangling-alloc-id-ice.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/ui/consts/dangling-alloc-id-ice.rs b/src/test/ui/consts/dangling-alloc-id-ice.rs
new file mode 100644
index 000000000..95acacdb7
--- /dev/null
+++ b/src/test/ui/consts/dangling-alloc-id-ice.rs
@@ -0,0 +1,15 @@
+// https://github.com/rust-lang/rust/issues/55223
+#![allow(const_err)]
+
+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() {}