Skip to content

Teach generic transmutability to reason about size inequality and unsized types #1940

@joshlf

Description

@joshlf

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions