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

Allow discriminant reads not followed by SwitchInt #132

Merged
merged 5 commits into from
Apr 23, 2024

Conversation

Nadrieril
Copy link
Member

We replace _x = Discr(_y); not followed by a SwitchInt with

match _y {
    0 => {
        _x := const (0 : isize)
    },
    1 => {
        _x := const (1 : isize)
    }
    ...
}

Fixes #120.

@Nadrieril
Copy link
Member Author

We can use this to make #91 work too, as soon as hax forwards the right information to us.

@Nadrieril Nadrieril force-pushed the bare-discriminant-read branch 2 times, most recently from 27378ad to fba2043 Compare April 18, 2024 12:12
charon/tests/ui/issue-91-enum-to-discriminant-cast.out Outdated Show resolved Hide resolved
charon/src/values_utils.rs Show resolved Hide resolved
charon/src/remove_read_discriminant.rs Outdated Show resolved Hide resolved
@Nadrieril Nadrieril force-pushed the bare-discriminant-read branch from fba2043 to f82338b Compare April 19, 2024 08:03
@Nadrieril Nadrieril requested review from sonmarcho and removed request for sonmarcho April 19, 2024 08:16
@sonmarcho
Copy link
Member

You're free to mark the conversation as resolved and merge when you consider they are.

@Nadrieril Nadrieril force-pushed the bare-discriminant-read branch from 426eb30 to f3890eb Compare April 23, 2024 15:03
@Nadrieril Nadrieril force-pushed the bare-discriminant-read branch from f3890eb to ea9f0c5 Compare April 23, 2024 15:08
@Nadrieril Nadrieril merged commit a9780a6 into main Apr 23, 2024
4 checks passed
@Nadrieril Nadrieril deleted the bare-discriminant-read branch April 23, 2024 15: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.

Support Rvalue::Discriminant not followed by SwitchInt
2 participants