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
Now, it's true that this requires unsafe, and might not even considered an issue or bug, and probably never happens in real productions code. However, many transmutes give a segfault when done wrong, this instead gives an illigal instruction.
The text was updated successfully, but these errors were encountered:
This is just UB, the code can do whatever. It's only an illegal instruction (ud2) because the compiler is nice. I think LLVM's trap-unreachable flag is doing this - otherwise main would just contain no instructions (since ! cannot be created main can never be reached) and fall through to whatever code happens to follow it.
transmuting to the never type causes an Illigal instruction: https://play.rust-lang.org/?gist=390b8739cfe0e25504f0602dcf546e7b&version=nightly&mode=release
Now, it's true that this requires unsafe, and might not even considered an issue or bug, and probably never happens in real productions code. However, many transmutes give a segfault when done wrong, this instead gives an illigal instruction.
The text was updated successfully, but these errors were encountered: