-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c6070e
commit 180bde5
Showing
13 changed files
with
132 additions
and
31 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
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
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
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
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
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,33 @@ | ||
#![flux::defs( | ||
fn is_start(x:bitvec<32>) -> bool { x == START } | ||
)] | ||
|
||
#[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 { | ||
BV32::new(0x4567) | ||
} | ||
|
||
#[flux_rs::sig(fn () -> BV32{v: is_start(v)})] | ||
pub fn test2() -> BV32 { | ||
BV32::new(0x4567) | ||
} | ||
|
||
#[flux_rs::sig(fn () -> BV32{v: is_start(v)})] | ||
pub fn test3() -> BV32 { | ||
BV32::new(0x4568) //~ ERROR: refinement type | ||
} |
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,28 @@ | ||
#![flux::defs( | ||
fn is_start(x:bitvec<32>) -> bool { x == START } | ||
)] | ||
|
||
#[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 { | ||
BV32::new(0x4567) | ||
} | ||
|
||
#[flux_rs::sig(fn () -> BV32{v: is_start(v)})] | ||
pub fn test2() -> BV32 { | ||
BV32::new(0x4567) | ||
} |
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