Skip to content

Extend validity checks for references and Box #3759

Description

@celinval
  • A reference or Box must be aligned, it cannot be dangling, and it must point to a valid value (in case of dynamically sized types, using the actual dynamic type of the pointee as determined by the metadata). Note that the last point (about pointing to a valid value) remains a subject of some debate.

  • The metadata of a wide reference, Box, or raw pointer must match the type of the unsized tail:

    • dyn Trait metadata must be a pointer to a compiler-generated vtable for Trait. (For raw pointers, this requirement remains a subject of some debate.)
    • Slice ([T]) metadata must be a valid usize. Furthermore, for wide references and Box, slice metadata is invalid if it makes the total size of the pointed-to value bigger than isize::MAX.

https://doc.rust-lang.org/reference/behavior-considered-undefined.html

Activity

  1. changed the title [-]Validity of references and Box[/-] [+]Extend validity checks for references and Box[/+] on Dec 5, 2024
  2. added
    [C] Feature / Enhancement
    on Dec 19, 2024
  3. added
    [E] Unsupported UB
    T-High Priority
    on Nov 5, 2026
  4. added this to the Soundness milestone on Nov 5, 2026
  5. self-assigned this
    on Nov 5, 2026
  6. added
    Z-Kani Compiler
    on Nov 6, 2026
  7. added
    [F] Soundness
    on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

T-High PriorityZ-Kani Compiler[C] Feature / Enhancement[E] Unsupported UB[F] Soundness

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions