Skip to content

transpile: Do not try to eliminate casts from integer literal to enum - #1965

Open
Rua wants to merge 4 commits into
immunant:masterfrom
Rua:literal-to-enum-cast
Open

transpile: Do not try to eliminate casts from integer literal to enum #1965
Rua wants to merge 4 commits into
immunant:masterfrom
Rua:literal-to-enum-cast

Conversation

@Rua

@Rua Rua commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

c2rust has for a long time created a "shortcut" if an integer literal is cast to an enum type, first added in e9e7e46. Instead of translating each of them as-is, it would attempt to emit an enum constant and fall back to an integer literal otherwise. But I think that's bad:

So I think it's best to just remove it and emit the literal and cast as they are.

@Rua Rua changed the title Literal to enum cast transpile: Do not try to eliminate casts from integer literal to enum Aug 1, 2026
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