You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Confusing wording in documentation for std::hint::unreachable_unchecked() #59549
It can enable the compiler to make optimizations based on the assumption that the function will never be executed.
If the function actually is executed, its behavior is undefined.
It then goes on to mention the unreachable!() macro, saying
The unreachable!() macro is the safe counterpart of this function, which will panic instead when executed.
This statement could be read as addressing the 2nd effect, but not the 1st. In other words, it could be interpreted as saying "the compiler will assume that unreachable!() will never be executed, but in the event that it is it will cause a panic." It might be worth rewording this statement to make it clear that neither (1) nor (2) applies to the safe version.
Activity
DevQps commentedon Apr 1, 2019
@Reconcyl Would you like to rephrase this yourself, or would you like me to take an attempt?
Rollup merge of rust-lang#59717 - Reconcyl:master, r=steveklabnik
Rollup merge of rust-lang#59717 - Reconcyl:master, r=steveklabnik
Rollup merge of rust-lang#59717 - Reconcyl:master, r=steveklabnik