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

impl_stable_hash_for! does not support enums with named fields #54075

Closed
RalfJung opened this issue Sep 9, 2018 · 0 comments
Closed

impl_stable_hash_for! does not support enums with named fields #54075

RalfJung opened this issue Sep 9, 2018 · 0 comments
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup.

Comments

@RalfJung
Copy link
Member

RalfJung commented Sep 9, 2018

In miri, we are now carrying some hand-written implementations of HashStable because the macro impl_stable_hash_for! does not support enum variants with named fields, e.g.

pub enum StackPopCleanup {
    Goto(Option<mir::BasicBlock>),
    None { cleanup: bool },
}

This is rather annoying and also error-prone, e.g. the manual implementations forgot to hash the discriminant.

impl_stable_hash_for! should support enums like the above.

@varkor varkor added the C-cleanup Category: PRs that clean code up or issues documenting cleanup. label Oct 3, 2018
kennytm added a commit to kennytm/rust that referenced this issue Oct 26, 2018
Extend the impl_stable_hash_for! macro for miri.

Fixes rust-lang#54075.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup.
Projects
None yet
Development

No branches or pull requests

2 participants