rust/tests/ui/consts/cycle-static-promoted.rs
Ralf Jung 5fa69deb00 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.)
2024-02-12 09:48:14 +01:00

13 lines
220 B
Rust

// 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() {}