fix cycle error when a static and a promoted are mutually recursive

This also now allows promoteds everywhere to point to 'extern static', because why not?
We still check that constants cannot transitively reach 'extern static' through references.
(We allow it through raw pointers.)
This commit is contained in:
Ralf Jung
2024-02-12 08:51:41 +01:00
parent 084ce5bdb5
commit 5fa69deb00
3 changed files with 29 additions and 24 deletions
+12
View File
@@ -0,0 +1,12 @@
// check-pass
struct Value {
values: &'static [&'static Value],
}
// This `static` recursively points to itself through a promoted (the slice).
static VALUE: Value = Value {
values: &[&VALUE],
};
fn main() {}