We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f6d6126 commit 7ea147eCopy full SHA for 7ea147e
src/transmutes.md
@@ -19,7 +19,10 @@ boggling.
19
* Transmute has an overloaded return type. If you do not specify the return type
20
it may produce a surprising type to satisfy inference.
21
22
-* Transmuting an `&` to `&mut` is UB.
+* Transmuting an `&` to `&mut` is UB. While certain usages may *appear* safe,
23
+ note that the Rust optimizer is free to assume that a shared reference won't
24
+ change through its lifetime and thus such transmutation will run afoul of those
25
+ assumptions. So:
26
* Transmuting an `&` to `&mut` is *always* UB.
27
* No you can't do it.
28
* No you're not special.
0 commit comments