Skip to content

Commit bef9355

Browse files
committed
Improve transmute diagnostics with a note about destructors
fixes #29922
1 parent 352853c commit bef9355

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/librustc/diagnostics.rs

+3
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,9 @@ It is also possible to manually transmute:
858858
```
859859
ptr::read(&v as *const _ as *const SomeType) // `v` transmuted to `SomeType`
860860
```
861+
862+
Note that this does not move `v` (unlike `transmute`), and may need a
863+
call to `mem::forget(v)` in case you want to avoid destructors being called.
861864
"##,
862865

863866
E0152: r##"

0 commit comments

Comments
 (0)