Skip to content

Is rustc guaranteed to reject code which "turns a pointer into raw bytes" in const code? #401

@joshlf

Description

@joshlf

In google/zerocopy#171 (comment), we're adding the ability to safely convert between byte slices/arrays and raw pointers. Currently, we have a test that is successfully failing if we try to perform this operation in a const context. What I want to know is: Is it guaranteed that code that performs any such conversion in a const context will always be rejected, or is this a best-effort analysis? If it's the former, then we can soundly emit the trait impls proposed in that PR, but if not, those impls would be unsound.

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