Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support deriving kani::Invariant for enums #3647

Open
carolynzech opened this issue Oct 25, 2024 · 0 comments
Open

Support deriving kani::Invariant for enums #3647

carolynzech opened this issue Oct 25, 2024 · 0 comments
Labels
[C] Feature / Enhancement A new feature request or enhancement to an existing feature.

Comments

@carolynzech
Copy link
Contributor

Requested feature: Update the derive macro for the kani::Invariant trait to incorporate the comments from #87 -- i.e., deleting the comments in trivial_invariant about floating point values and supporting enums for the derive macro.

Use case: derive kani::Invariant on enums.

Test case:

#[derive(kani::Invariant)]
enum MyEnum {
    OptionOne(u32, u32),
    OptionTwo(u32),
    OptionThree
}

currently produces

error: proc-macro derive panicked
 --> src/lib.rs:7:10
  |
7 | #[derive(kani::Invariant)]
  |          ^^^^^^^^^^^^^^^
  |
  = help: message: internal error: entered unreachable code

because we have unreachable!() statements for enums and unions in the derive macro implementation.

@carolynzech carolynzech added the [C] Feature / Enhancement A new feature request or enhancement to an existing feature. label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C] Feature / Enhancement A new feature request or enhancement to an existing feature.
Projects
None yet
Development

No branches or pull requests

1 participant