Skip to content

Concerning use of empty enums for opaque types #358

@FeldrinH

Description

@FeldrinH

pcap_t and pcap_dumper_t seem to be represented by empty enums on the Rust side. According to the Rustonomicon this is a bad idea.

From https://doc.rust-lang.org/nomicon/ffi.html#representing-opaque-structs:

Notice that it is a really bad idea to use an empty enum as FFI type. The compiler relies on empty enums being uninhabited, so handling values of type &Empty is a huge footgun and can lead to buggy program behavior (by triggering undefined behavior).

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