-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crucible-mir: Handle repr(transparent) enums appropriately (#1141)
There were two places in the code where `repr(transparent)` enums ought to have been treated specially, but weren't: * In the `ConstEnum` case for `transConstVal`. * In the `AdtAg` case of `transRval`, which handles enum variant assignments. I've now added the appropriate special-casing and added a `conc_eval/enum/repr_transparent.rs` test case in the `crux-mir` test suite to ensure that it works as expected. Fixes #1140.
- Loading branch information
1 parent
1c9979d
commit bb50c0d
Showing
2 changed files
with
69 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// A regression test for | ||
// https://github.com/GaloisInc/crucible/issues/1140 | ||
#![cfg_attr(not(with_main), no_std)] | ||
|
||
#[repr(transparent)] | ||
pub enum E { | ||
MkE(u32), | ||
} | ||
|
||
pub fn f() -> u32 { | ||
let x = E::MkE(42); | ||
match x { | ||
E::MkE(y) => y, | ||
} | ||
} | ||
|
||
#[cfg(with_main)] | ||
pub fn main() { | ||
println!("{:?}", f()); | ||
} | ||
#[cfg(not(with_main))] #[cfg_attr(crux, crux::test)] | ||
pub fn crux_test() -> u32 { f() } |