Skip to content

Enums in FFI types are unsafe #231

@Stebalien

Description

@Stebalien

It looks like we're using enums in FFI types in several places, but this is inherently unsafe as we can end up creating enums with arbitrary values and the rust type system will assume that this can't happen.

This can cause problems like:

  1. Code checking said enum value may be optimized away.
  2. If the enum has no zero variant but a zero is passed, rust may interpret Option<Enum> as None.
  3. Really, whatever the rust compiler wants to do.

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