Skip to content

Commit bb9b988

Browse files
committed
introduce differing_sizes lint
#2981 (comment)
1 parent a325078 commit bb9b988

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

text/0000-safer-transmute.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ A value may ***not*** be transmuted into a type of greater size, if doing so wou
203203
let _ : [u8; 32] = transmute!([u8; 16]::default()); // Compile Error!
204204
```
205205

206+
A `differing_sizes` lint reports warnings for invocations of `transmute!()` where the source and destination types are different sizes.
207+
206208
#### Requirements on References
207209
[transmute-references]: #requirements-on-references
208210

@@ -941,6 +943,8 @@ Unless `NeglectConstructability` is used as `Neglect` option, a `Src` is *safely
941943
If `Src` is a mutatable reference, then additionally:
942944
1. `Src: Constructible<Scope>`
943945

946+
### Implementing `differing_sizes`
947+
The `differing_sizes` lint reports a compiler warning when the source and destination types of a `transmute!()`, `transmute_into` or `transmute_from` invocation differ. This lint shall be warn-by-default.
944948

945949
### Minimal Useful Stabilization Surface
946950
Stabilizing *only* these items of the Initial Smart Implementation will cover many use-cases:

0 commit comments

Comments
 (0)