Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/transmutes.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ boggling.
* Transmute has an overloaded return type. If you do not specify the return type
it may produce a surprising type to satisfy inference.

* Transmuting an `&` to `&mut` is UB.
* Transmuting an `&` to `&mut` is UB. While certain usages may *appear* safe,
note that the Rust optimizer is free to assume that a shared reference won't
change through its lifetime and thus such transmutation will run afoul of those
assumptions. So:
* Transmuting an `&` to `&mut` is *always* UB.
* No you can't do it.
* No you're not special.
Expand Down