Skip to content

IsComplete may check requires, making checking before writing to a 0-initialized buffer difficult. #240

@jasongraffius

Description

@jasongraffius

In the C++ runtime if a type has a requires clause and that field is used in determining the size of the struct, IsComplete appears to check that requires clause. This means a generic approach of 0-initializing a buffer then checking IsComplete breaks for structs that have fields that exclude 0, for instance.

Workarounds involve either leaving it unchecked and manually confirming (defeating the purpose of checks like IsComplete) or splitting definitions into fixed-size portions and variable-sized portions.

We should evaluate whether IsComplete should ignore the requires for these fields, or if there's a good reason we need to ensure the consistency of these fields, potentially provide a verifier that ensures that all fixed-size, fixed-location portions of the struct are safe to write to, allowing the client code to call IsComplete once they've initialized those to ensure the entire struct is safe to write to.

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