Closed
Description
The documentation for the unreachable!
macro says:
If the determination that the code is unreachable proves incorrect, the program immediately terminates with a
panic!
. The functionunreachable_unchecked
, which belongs to thestd::hint
module, informs the compiler to optimize the code out of the release version entirely.
This is incorrect; while building in release (and thus with optimizations) certainly makes the compiler more likely to exploit unreachable_unchecked
, it is still UB to reach it without optimizations enabled, and LLVM is under no obligation to exploit it when compiling in release mode.
I'm not sure what this should be changed to, which is why I'm not just submitting a PR.