Skip to content

Commit

Permalink
bless, add surrounding error context for postconditions too
Browse files Browse the repository at this point in the history
  • Loading branch information
Aurel300 committed Jul 18, 2023
1 parent 8188d32 commit d49abc7
Show file tree
Hide file tree
Showing 31 changed files with 615 additions and 446 deletions.
1 change: 1 addition & 0 deletions prusti-interface/src/environment/loops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ impl<'b, 'tcx> Visitor<'tcx> for AccessCollector<'b, 'tcx> {
NonMutatingUse(mir::visit::NonMutatingUseContext::Copy) => PlaceAccessKind::Read,
NonMutatingUse(mir::visit::NonMutatingUseContext::Move) => PlaceAccessKind::Move,
NonMutatingUse(mir::visit::NonMutatingUseContext::Inspect) => PlaceAccessKind::Read,
NonMutatingUse(mir::visit::NonMutatingUseContext::PlaceMention) => PlaceAccessKind::Read,
NonMutatingUse(mir::visit::NonMutatingUseContext::SharedBorrow) => {
PlaceAccessKind::SharedBorrow
}
Expand Down
4 changes: 2 additions & 2 deletions prusti-tests/tests/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ fn test_runner(_tests: &[&()]) {

// Filter the tests to run
let filter = env::args().nth(1);

/*
// Test the parsing of specifications. This doesn't run the verifier.
println!("[parse]");
run_no_verification("parse", &filter);
Expand All @@ -191,7 +191,7 @@ fn test_runner(_tests: &[&()]) {
println!("[verify]");
run_verification_no_overflow("verify", &filter);
save_verification_cache();

*/
// Test the verifier with overflow checks enabled.
println!("[verify_overflow]");
run_verification_overflow("verify_overflow", &filter);
Expand Down
10 changes: 6 additions & 4 deletions prusti-tests/tests/parse/ui/after_expiry.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@



#![feature(type_ascription)]
#![feature(stmt_expr_attributes)]
#![feature(register_tool)]
#![register_tool(prusti)]
Expand All @@ -23,7 +22,8 @@ non_snake_case)]
#[prusti::spec_id = "$(NUM_UUID)"]
fn prusti_pledge_item_test1_$(NUM_UUID)(a: bool,
result: ()) -> bool {
!!((a): bool)
let prusti_result: bool = a;
prusti_result
}
#[prusti::pledge_spec_id_ref = "$(NUM_UUID)"]
#[prusti::specs_version = $(SPECS_VERSION)]
Expand All @@ -34,7 +34,8 @@ non_snake_case)]
#[prusti::spec_id = "$(NUM_UUID)"]
fn prusti_pledge_item_test2_$(NUM_UUID)(a: bool,
result: ()) -> bool {
!!((a): bool)
let prusti_result: bool = a;
prusti_result
}
#[prusti::pledge_spec_id_ref = "$(NUM_UUID)"]
#[prusti::specs_version = $(SPECS_VERSION)]
Expand All @@ -45,7 +46,8 @@ non_snake_case)]
#[prusti::spec_id = "$(NUM_UUID)"]
fn prusti_pledge_item_test3_$(NUM_UUID)(x: u32,
result: u32) -> bool {
!!((result == match x { 1 => 1, 2 => 2, _ => 0, }): bool)
let prusti_result: bool = result == match x { 1 => 1, 2 => 2, _ => 0, };
prusti_result
}
#[prusti::pledge_spec_id_ref = "$(NUM_UUID)"]
#[prusti::specs_version = $(SPECS_VERSION)]
Expand Down
16 changes: 10 additions & 6 deletions prusti-tests/tests/parse/ui/and.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@



#![feature(type_ascription)]
#![feature(stmt_expr_attributes)]
#![feature(register_tool)]
#![register_tool(prusti)]
Expand All @@ -24,7 +23,8 @@ non_snake_case)]
#[prusti::spec_only]
#[prusti::spec_id = "$(NUM_UUID)"]
fn prusti_pre_item_test1_$(NUM_UUID)() -> bool {
!!(((true) && (true)): bool)
let prusti_result: bool = (true) && (true);
prusti_result
}
#[prusti::pre_spec_id_ref = "$(NUM_UUID)"]
#[prusti::specs_version = $(SPECS_VERSION)]
Expand All @@ -34,7 +34,8 @@ non_snake_case)]
#[prusti::spec_only]
#[prusti::spec_id = "$(NUM_UUID)"]
fn prusti_pre_item_test2_$(NUM_UUID)() -> bool {
!!((((true) && (true)) && (true)): bool)
let prusti_result: bool = ((true) && (true)) && (true);
prusti_result
}
#[prusti::pre_spec_id_ref = "$(NUM_UUID)"]
#[prusti::specs_version = $(SPECS_VERSION)]
Expand All @@ -44,7 +45,8 @@ non_snake_case)]
#[prusti::spec_only]
#[prusti::spec_id = "$(NUM_UUID)"]
fn prusti_pre_item_test3_$(NUM_UUID)() -> bool {
!!(((true) && (((true) && (true)))): bool)
let prusti_result: bool = (true) && (((true) && (true)));
prusti_result
}
#[prusti::pre_spec_id_ref = "$(NUM_UUID)"]
#[prusti::specs_version = $(SPECS_VERSION)]
Expand All @@ -54,7 +56,8 @@ non_snake_case)]
#[prusti::spec_only]
#[prusti::spec_id = "$(NUM_UUID)"]
fn prusti_pre_item_test4_$(NUM_UUID)() -> bool {
!!(((((true) && (true))) && (true)): bool)
let prusti_result: bool = (((true) && (true))) && (true);
prusti_result
}
#[prusti::pre_spec_id_ref = "$(NUM_UUID)"]
#[prusti::specs_version = $(SPECS_VERSION)]
Expand All @@ -64,7 +67,8 @@ non_snake_case)]
#[prusti::spec_only]
#[prusti::spec_id = "$(NUM_UUID)"]
fn prusti_pre_item_test5_$(NUM_UUID)() -> bool {
!!(((((true) && (true))) && (((true) && (true)))): bool)
let prusti_result: bool = (((true) && (true))) && (((true) && (true)));
prusti_result
}
#[prusti::pre_spec_id_ref = "$(NUM_UUID)"]
#[prusti::specs_version = $(SPECS_VERSION)]
Expand Down
19 changes: 12 additions & 7 deletions prusti-tests/tests/parse/ui/assert_on_expiry.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@



#![feature(type_ascription)]
#![feature(stmt_expr_attributes)]
#![feature(register_tool)]
#![register_tool(prusti)]
Expand All @@ -24,15 +23,17 @@ non_snake_case)]
#[prusti::spec_id = "$(NUM_UUID)"]
fn prusti_pledge_item_test1_$(NUM_UUID)(a: bool,
result: ()) -> bool {
!!((true): bool)
let prusti_result: bool = true;
prusti_result
}
#[allow(unused_must_use, unused_parens, unused_variables, dead_code,
non_snake_case)]
#[prusti::spec_only]
#[prusti::spec_id = "$(NUM_UUID)"]
fn prusti_pledge_item_test1_$(NUM_UUID)(a: bool,
result: ()) -> bool {
!!((a): bool)
let prusti_result: bool = a;
prusti_result
}
#[prusti::assert_pledge_spec_id_ref_lhs = "$(NUM_UUID)"]
#[prusti::assert_pledge_spec_id_ref_rhs = "$(NUM_UUID)"]
Expand All @@ -44,15 +45,17 @@ non_snake_case)]
#[prusti::spec_id = "$(NUM_UUID)"]
fn prusti_pledge_item_test2_$(NUM_UUID)(a: bool,
result: ()) -> bool {
!!((true): bool)
let prusti_result: bool = true;
prusti_result
}
#[allow(unused_must_use, unused_parens, unused_variables, dead_code,
non_snake_case)]
#[prusti::spec_only]
#[prusti::spec_id = "$(NUM_UUID)"]
fn prusti_pledge_item_test2_$(NUM_UUID)(a: bool,
result: ()) -> bool {
!!((a): bool)
let prusti_result: bool = a;
prusti_result
}
#[prusti::assert_pledge_spec_id_ref_lhs = "$(NUM_UUID)"]
#[prusti::assert_pledge_spec_id_ref_rhs = "$(NUM_UUID)"]
Expand All @@ -64,15 +67,17 @@ non_snake_case)]
#[prusti::spec_id = "$(NUM_UUID)"]
fn prusti_pledge_item_test3_$(NUM_UUID)(x: u32,
result: u32) -> bool {
!!((true): bool)
let prusti_result: bool = true;
prusti_result
}
#[allow(unused_must_use, unused_parens, unused_variables, dead_code,
non_snake_case)]
#[prusti::spec_only]
#[prusti::spec_id = "$(NUM_UUID)"]
fn prusti_pledge_item_test3_$(NUM_UUID)(x: u32,
result: u32) -> bool {
!!((result == match x { 1 => 1, 2 => 2, _ => 0, }): bool)
let prusti_result: bool = result == match x { 1 => 1, 2 => 2, _ => 0, };
prusti_result
}
#[prusti::assert_pledge_spec_id_ref_lhs = "$(NUM_UUID)"]
#[prusti::assert_pledge_spec_id_ref_rhs = "$(NUM_UUID)"]
Expand Down
Loading

0 comments on commit d49abc7

Please sign in to comment.