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

humility-core: allow enums with signed variants #469

Merged
merged 3 commits into from
Apr 3, 2024

Conversation

cbiffle
Copy link
Contributor

@cbiffle cbiffle commented Apr 2, 2024

Humility currently assumes that any enum discriminant can be represented as a u64. This isn't at all true, and in fact fails for common Rust types. See #468 for more details.

This fixes it to handle basic cases of signed enum variants. It's entirely possible that some places in Humility still won't handle them correctly, because logic for loading the enum discriminator isn't reliably centralized in one place, and I may have missed cases.

Fixes #468.

@cbiffle cbiffle force-pushed the cbiffle/fix-signed-variants branch from 3c4dcd7 to 1698d0b Compare April 2, 2024 00:45
@cbiffle cbiffle marked this pull request as ready for review April 2, 2024 00:46
@cbiffle cbiffle requested a review from bcantrill April 2, 2024 00:46
Copy link
Contributor

@bcantrill bcantrill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this, and my apologies for the assumption that Humility was making. The change looks good -- or at least better than it was with respect to the great disappointment that is the complexity of reality. (Is it worth opening an issue to track the TODOs?)

@cbiffle
Copy link
Contributor Author

cbiffle commented Apr 3, 2024

Good point, filed #471 as a follow-up listing those cases.

@cbiffle cbiffle enabled auto-merge (squash) April 3, 2024 21:20
@cbiffle cbiffle merged commit 377feb9 into master Apr 3, 2024
11 checks passed
@cbiffle cbiffle deleted the cbiffle/fix-signed-variants branch April 3, 2024 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Humility assumes enum discriminants are u64, can't parse recent output
2 participants