Skip to content

Use module-const style for all enums#37

Open
sgrif wants to merge 1 commit into
mainfrom
sg-use-enum-modules
Open

Use module-const style for all enums#37
sgrif wants to merge 1 commit into
mainfrom
sg-use-enum-modules

Conversation

@sgrif

@sgrif sgrif commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

I've been getting frustrated when I'm looking at the docs for a type, it's a primitive alias, and then clicking the type in rustdoc doesn't take me to something that shows me the variants, and there's no way to easily get to them from that page.

I'm skittish about using rustified enums for any of these, as in C they're just integers, so it's possible to pass an unexpected value. If we then cast that to a Rust enum, the result will be undefined behavior.

Since we don't expect to ever allow exhaustive matching anyway, using the module const form seems like a reasonable compromise.

I've been getting frustrated when I'm looking at the docs for a type,
it's a primitive alias, and then clicking the type in rustdoc doesn't
take me to something that shows me the variants, and there's no way to
easily get to them from that page.

I'm skittish about using rustified enums for any of these, as in C
they're *just* integers, so it's possible to pass an unexpected value.
If we then cast that to a Rust enum, the result will be undefined
behavior.

Since we don't expect to ever allow exhaustive matching anyway, using
the module const form seems like a reasonable compromise.
@sgrif sgrif requested review from levkk and meskill July 13, 2026 17:18
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.

1 participant