Supporting const sorts that are not integers
#935
Replies: 2 comments 2 replies
-
|
Something else to consider is that we probably want to keep the behavior we already have for integers where we evaluate and then map the bytes, so the reflection strategy needs to change depending on the type. Also, a couple of pointers:
|
Beta Was this translation helpful? Give feedback.
-
|
Moving discussion in #932 (comment) here @ranjitjhala it's silly that we didn't anticipate this but if we write #[flux_rs::constant(bv_int_to_bv32(0x4567))]
pub const START: BV32 = BV32::new(0x4567);we need to make sure we give Right now we lower concretely, the following should work #[flux::opaque]
#[flux::refined_by(val: bitvec<32>)]
pub struct BV32(u32);
impl BV32 {
#[flux::trusted]
#[flux::sig(fn (x:u32) -> BV32[bv_int_to_bv32(x)])]
const fn new(val: u32) -> Self {
BV32(val)
}
}
#[flux_rs::constant(bv_int_to_bv32(0x4567))]
pub const START: BV32 = BV32::new(0x4567);
#[flux_rs::sig(fn () -> BV32[START])]
pub fn test1() -> BV32 {
START
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Specifically, related to #886 and @vrindisbacher's #932
Summarizing the discussion on slack with @nilehmann to support the following
It sounds to me like there are three distinct things we need.
STEP 1. Use the signature of a
constin other specifications (which is #932)STEP 2. Check the signature of a
constagainst its own (MIR) definitionSTEP 3. Synthesize the signature of a
constfrom its definition (which is #886)For (1) we need to
rustc_middle::ty::Tywe can use to avoid circularitiesBLAHinto the refinement logic i.e. replace occurrences ofBLAHin refinements withint_to_bv32(0x4567)?Specifically, get the below working
Beta Was this translation helpful? Give feedback.
All reactions