-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-bugCategory: This is a bug.Category: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
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.
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-bugCategory: This is a bug.Category: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.