mirror of
https://github.com/rust-lang/rust.git
synced 2025-09-26 20:21:59 +00:00
43 lines
869 B
Rust
43 lines
869 B
Rust
//@ known-bug: #144293
|
|
// Same as recursion-etc but eggs LLVM emission into giving indirect arguments.
|
|
#![expect(incomplete_features)]
|
|
#![feature(explicit_tail_calls)]
|
|
|
|
use std::hint::black_box;
|
|
|
|
struct U64Wrapper {
|
|
pub x: u64,
|
|
pub arbitrary: String,
|
|
}
|
|
|
|
fn count(curr: U64Wrapper, top: U64Wrapper) -> U64Wrapper {
|
|
if black_box(curr.x) >= top.x {
|
|
curr
|
|
} else {
|
|
become count(
|
|
U64Wrapper {
|
|
x: curr.x + 1,
|
|
arbitrary: curr.arbitrary,
|
|
},
|
|
top,
|
|
)
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
println!(
|
|
"{}",
|
|
count(
|
|
U64Wrapper {
|
|
x: 0,
|
|
arbitrary: "hello!".into()
|
|
},
|
|
black_box(U64Wrapper {
|
|
x: 1000000,
|
|
arbitrary: "goodbye!".into()
|
|
})
|
|
)
|
|
.x
|
|
);
|
|
}
|