mirror of
https://github.com/rust-lang/rust.git
synced 2025-12-01 00:17:44 +00:00
22 lines
456 B
Rust
22 lines
456 B
Rust
//@ compile-flags: -Zmir-opt-level=0
|
|
|
|
#[derive(Debug)]
|
|
pub struct Thing {
|
|
pub next: &'static Thing,
|
|
}
|
|
|
|
pub static THING: Thing = Thing { next: &THING };
|
|
// CHECK: alloc{{.+}} (static: THING)
|
|
|
|
const fn thing() -> &'static Thing {
|
|
&MUTUALLY_RECURSIVE
|
|
}
|
|
|
|
pub static MUTUALLY_RECURSIVE: Thing = Thing { next: thing() };
|
|
// CHECK: alloc{{.+}} (static: MUTUALLY_RECURSIVE)
|
|
|
|
fn main() {
|
|
// Generate optimized MIR for the const fn, too.
|
|
thing();
|
|
}
|