Skip to content

Commit

Permalink
introduce differing_sizes lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jswrenn committed Oct 12, 2020
1 parent a325078 commit bb9b988
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions text/0000-safer-transmute.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ A value may ***not*** be transmuted into a type of greater size, if doing so wou
let _ : [u8; 32] = transmute!([u8; 16]::default()); // Compile Error!
```

A `differing_sizes` lint reports warnings for invocations of `transmute!()` where the source and destination types are different sizes.

#### Requirements on References
[transmute-references]: #requirements-on-references

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

### Implementing `differing_sizes`
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.

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

0 comments on commit bb9b988

Please sign in to comment.