Famously, an infinite loop without side effects is UB in C++. I can write similar code in Safe Rust. Is such code well-defined? What is its defined behavior?
It's well-defined behavior precisely because it can be written in safe Rust and safe Rust is not supposed to allow UB.
There were few bugs in compiler in the past, though.
It runs forever with no side-effects.
Indeed, probably discussed here: https://github.com/rust-lang/rust/issues/28728
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.