about summary refs log tree commit diff
path: root/tests/ui/recursion/recursive-static-definition.rs
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2023-10-12 11:27:43 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-02-15 10:25:18 +0000
commit73b38c661d9bc0466547af16d20089e5383f754b (patch)
treedd1f51759001e523446d03e4f07f974c70f31dda /tests/ui/recursion/recursive-static-definition.rs
parente2386270df9d619bb6d3d62664e89c632baeb6cb (diff)
downloadrust-73b38c661d9bc0466547af16d20089e5383f754b.tar.gz
rust-73b38c661d9bc0466547af16d20089e5383f754b.zip
Do not allocate a second "background" alloc id for the main allocation of a static.
Instead we re-use the static's alloc id within the interpreter for its initializer to refer to the `Allocation` that only exists within the interpreter.
Diffstat (limited to 'tests/ui/recursion/recursive-static-definition.rs')
-rw-r--r--tests/ui/recursion/recursive-static-definition.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/ui/recursion/recursive-static-definition.rs b/tests/ui/recursion/recursive-static-definition.rs
index 74a094a9b01..5317c47076e 100644
--- a/tests/ui/recursion/recursive-static-definition.rs
+++ b/tests/ui/recursion/recursive-static-definition.rs
@@ -1,4 +1,12 @@
 pub static FOO: u32 = FOO;
-//~^ ERROR cycle detected when evaluating initializer of static `FOO`
+//~^ ERROR could not evaluate static initializer
+
+#[derive(Copy, Clone)]
+pub union Foo {
+    x: u32,
+}
+
+pub static BAR: Foo = BAR;
+//~^ ERROR could not evaluate static initializer
 
 fn main() {}