I tried this code:
#[inline(never)]
#[no_mangle]
const fn deep(n: usize) {
match n {
0 => (),
_ => deep(n - 1),
}
}
#[inline(always)]
const fn inf() -> ! {
inf()
}
fn main() {
deep(usize::MAX);
println!("✅");
inf();
}
I expected to see this happen: prints "✅" fast and successfully, then hangs in an infinite loop.
Instead, this happened: prints "✅" fast and panics with stderr:
Compiling playground v0.0.1 (/playground)
Finished `release` profile [optimized] target(s) in 0.38s
Running `target/release/playground`
thread 'main' has overflowed its stack
fatal runtime error: stack overflow
It seems commenting-out the attributes is no-op here.
Meta
https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=ed0941cd328e49d8737fdff01cd4a4aa
rustc --version --verbose:
1.80.0-nightly
(2024-05-28 da159eb331b27df52818)
Backtrace
Apologies in advance, if this issue is a dupe. I tried my best to find similar ones
I tried this code:
I expected to see this happen: prints
"✅"fast and successfully, then hangs in an infinite loop.Instead, this happened: prints
"✅"fast and panics withstderr:It seems commenting-out the attributes is no-op here.
Meta
https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=ed0941cd328e49d8737fdff01cd4a4aa
rustc --version --verbose:Backtrace
Apologies in advance, if this issue is a dupe. I tried my best to find similar ones