Skip to content

Implement FromZeroes for Option types? #293

Closed
@joshlf

Description

@joshlf

Some Option types have known layouts/bit validity (e.g., Option<&T> where T: Sized). Are these actually guaranteed, or just "in practice everyone knows that's how the compiler does it"? If it's the former, and we know that None is represented as a sequence of zeroes, then it should be sound to implement FromZeroes for these types.

Task:

  • Find types, T, for which we can implement FromZeroes for Option<T> (EDIT: Here's a breadcrumb)
  • For each such type, ensure that we can make a bulletproof soundness argument based on the Rust reference and the standard library documentation
  • Put up a PR to emit the appropriate impl.

I've submitted rust-lang/rust#115333 to clarify the representation of Options and hopefully unblock more of this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    compatibility-nonbreakingChanges that are (likely to be) non-breakingexperience-hardThis issue is hard, and requires a lot of experiencehelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions