forked from viperproject/prusti-dev
-
Notifications
You must be signed in to change notification settings - Fork 9
Fix using assert_eq #136
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
Merged
JonasAlaif
merged 14 commits into
Aurel300:rewrite-2023
from
ThomasMayerl:fix_assert_eq
Feb 27, 2026
Merged
Fix using assert_eq #136
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
09ced68
Fix using assert_eq
ThomasMayerl 4032b9a
Add tests and implement support for alloc consts
ThomasMayerl 4430d81
Rebase
ThomasMayerl 3ee5224
Run fmt
ThomasMayerl e1ffcfc
Make recursive encode_scalar
ThomasMayerl 816f795
Bring comment back
ThomasMayerl 22a8af2
Clean up comments
JonasAlaif 61208bf
Clean up
JonasAlaif c6b6931
Clean up 2
JonasAlaif d6c036d
change how we read bytes from an allocation
ThomasMayerl 13a1100
Temporarily fix Prusti crashing upon encountering &str const
ThomasMayerl df212fc
Remove print
ThomasMayerl a3498b4
Remove workaround that unsupported consts do not crash Prusti
ThomasMayerl 4fc5a81
Renaming and slight cleanup
JonasAlaif File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,49 @@ | ||
| use task_encoder::TaskEncoder; | ||
| use vir::{Function, FunctionIdn, ViperIdent}; | ||
|
|
||
| /// Encodes the `Int` to `Ref` function to construct a reference from an address. In | ||
| /// the future this will also likely include a second `Int` tag argument | ||
| /// (from SB or TB) and inverse functions for both. | ||
| pub struct RefDataEnc; | ||
|
|
||
| #[derive(Debug, Clone)] | ||
| pub struct RefData<'vir> { | ||
| pub addr_to_ref: vir::FunctionIdn<'vir, vir::Int, vir::Ref>, | ||
| } | ||
|
|
||
| #[derive(Debug, Clone)] | ||
| pub struct RefDataLocal<'vir> { | ||
| addr_to_ref_fn: Function<'vir>, | ||
| } | ||
|
|
||
| impl TaskEncoder for RefDataEnc { | ||
| task_encoder::encoder_cache!(RefDataEnc); | ||
| type TaskDescription<'vir> = (); | ||
| type OutputFullLocal<'vir> = RefDataLocal<'vir>; | ||
| type OutputFullDependency<'vir> = RefData<'vir>; | ||
|
|
||
| type TaskKey<'vir> = Self::TaskDescription<'vir>; | ||
|
|
||
| fn task_to_key<'vir>(_task: &Self::TaskDescription<'vir>) -> Self::TaskKey<'vir> {} | ||
|
|
||
| fn do_encode_full<'vir>( | ||
| task_key: &Self::TaskKey<'vir>, | ||
| deps: &mut task_encoder::TaskEncoderDependencies<'vir, Self>, | ||
| ) -> task_encoder::EncodeFullResult<'vir, Self> { | ||
| deps.emit_output_ref(*task_key, ())?; | ||
| let addr_to_ref = | ||
| FunctionIdn::new(ViperIdent::new("addr_to_ref"), vir::TYPE_INT, vir::TYPE_REF); | ||
| let addr_to_ref_fn = vir::with_vcx(|vcx| { | ||
| let arg_decl = vcx.mk_local_decl("arg", vir::TYPE_INT); | ||
| vcx.mk_function(addr_to_ref, (arg_decl,), &[], &[], None, None) | ||
| }); | ||
| Ok((RefDataLocal { addr_to_ref_fn }, RefData { addr_to_ref })) | ||
| } | ||
|
|
||
| fn emit_outputs<'vir>(program: &mut task_encoder::Program<'vir>) { | ||
| let outputs = RefDataEnc::all_outputs_local_no_errors(); | ||
| for output in outputs { | ||
| program.add_function(output.addr_to_ref_fn); | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,9 @@ | ||
| fn fail() { | ||
| assert_eq!(1, 8); | ||
| } | ||
|
|
||
| fn fail2() { | ||
| let x = 5; | ||
| let y = 4 - 1; | ||
| assert_eq!(x, y); | ||
| } |
This file contains hidden or 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,9 @@ | ||
| fn pass() { | ||
| assert_eq!(1, 1); | ||
| } | ||
|
|
||
| fn pass2() { | ||
| let x = 5; | ||
| let y = 4 + 1; | ||
| assert_eq!(x, y); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.