Skip to content

Non-exhaustive enums seem to trouble uniffi #2414

@tmathern

Description

@tmathern

Repro from branch in contentauth/c2pa-python#82 (clone, checkout the branch, run `cargo build).

In our code,

It seems this troubles uniffi, as the build fails:

   Compiling c2pa-python v0.6.2 (/git/@CAI/c2pa-python)
error[E0004]: non-exhaustive patterns: `_` not covered
   --> /git/@CAI/c2pa-python/target/debug/build/c2pa-python-3be618cc7bdb8e16/out/c2pa.uniffi.rs:115:1
    |
115 | #[::uniffi::udl_derive(Enum)]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `_` not covered
    |
note: `SigningAlg` defined here
   --> /.cargo/registry/src/index.crates.io-6f17d22bba15001f/c2pa-crypto-0.3.0/src/raw_signature/signing_alg.rs:32:1
    |
32  | pub enum SigningAlg {
    | ^^^^^^^^^^^^^^^^^^^
    = note: the matched value is of type `SigningAlg`
    = note: `SigningAlg` is marked as non-exhaustive, so a wildcard `_` is necessary to match exhaustively
    = note: this error originates in the attribute macro `::uniffi::udl_derive` (in Nightly builds, run with -Z macro-backtrace for more info)
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
    |
115 | #[::uniffi::udl_derive(Enum)], _ => todo!()
    |                              ++++++++++++++

For more information about this error, try `rustc --explain E0004`.

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