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

Const declaration for array types #1131

Open
y1ca1 opened this issue May 20, 2024 · 0 comments
Open

Const declaration for array types #1131

y1ca1 opened this issue May 20, 2024 · 0 comments

Comments

@y1ca1
Copy link
Contributor

y1ca1 commented May 20, 2024

use vstd::prelude::*;
verus! {

spec const SPEC_BAR: int = 100;
// works
exec const BAR: u8 ensures BAR@ == SPEC_BAR { 100u8 }

spec const SPEC_FOO: Seq<u8> = seq![1, 0, 0, 0];
// doesn't work
exec const FOO: [u8; 4] ensures FOO@ == SPEC_FOO { [1, 0, 0, 0] }

// works
exec const FOO: [u8; 4] ensures FOO@ == SPEC_FOO { 
    let foo: [u8; 4] = [1,0,0,0];
    assert(foo@ == seq![1u8,0,0,0]);
    foo
}


}

Maybe it's fine to have this explicit assertion for arrarys...

Link to code

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

No branches or pull requests

1 participant