diff options
| author | Ralf Jung <post@ralfj.de> | 2022-07-22 14:51:23 -0400 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2022-07-22 14:51:23 -0400 |
| commit | 5d95a36244f60bbbc5134310460e7597e82e41b1 (patch) | |
| tree | 7b0def74aa7dd8649d4f84c0a3c59916b39073e1 | |
| parent | 22d25f21dc008785f52e7c2833de4f4236b1066b (diff) | |
| download | rust-5d95a36244f60bbbc5134310460e7597e82e41b1.tar.gz rust-5d95a36244f60bbbc5134310460e7597e82e41b1.zip | |
do not claim that transmute is like memcpy
| -rw-r--r-- | library/core/src/intrinsics.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs index dc82b32214c..6bf95a1b008 100644 --- a/library/core/src/intrinsics.rs +++ b/library/core/src/intrinsics.rs @@ -1212,8 +1212,9 @@ extern "rust-intrinsic" { /// /// `transmute` is semantically equivalent to a bitwise move of one type /// into another. It copies the bits from the source value into the - /// destination value, then forgets the original. It's equivalent to C's - /// `memcpy` under the hood, just like `transmute_copy`. + /// destination value, then forgets the original. Note that source and destination + /// are passed by-value, which means if `T` or `U` contains padding, that padding + /// might *not* be preserved by `transmute`. /// /// Because `transmute` is a by-value operation, alignment of the *transmuted values /// themselves* is not a concern. As with any other function, the compiler already ensures |
