google / google/zerocopy

Teach generic transmutability to reason about size inequality and unsized types

Open
#1,940 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2.6k
Forks
179
Avg merge
1d 19h
Merged PRs (30d)
29

Description

We would like to support all combinations of the following axes
- Src type sized or unsized
- Dst type sized or unsized
- Src larger than, same size as, or smaller than Dst type for the same fat pointer metadata
- Includes when Src is sized and Dst is unsized and vice-versa
- Dst same size as Src given a metadata fix-up operation

Some specific operations we could support:
- Sizes same w/o metadata fix-up: permits shared and exclusive reference casts
- For same metadata, Dst smaller than Src: supports shared reference casts
- When both types are sized: supports by-value transmute
- For same metadata, Dst larger than Src: supports by-value transmute if uninit bytes are valid at the end of Dst
- Sizes same given metadata fix-up: shared and exclusive casts (with metadata fix-up)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.