Skip to content

Commit 7c055e0

Browse files
authored
vstd: finish proving lemmas for Seq (#2669)
1 parent d176907 commit 7c055e0

5 files changed

Lines changed: 1146 additions & 331 deletions

File tree

source/rust_verify_test/tests/mut_refs_patterns.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2374,7 +2374,7 @@ test_verify_one_file_with_options! {
23742374
}
23752375
}
23762376
}
2377-
} => Err(err) => assert_vir_error_msg(err, "a 'mut ref' binding in a pattern is only allowed for exec mode")
2377+
} => Err(err) => assert_vir_error_msg(err, "a 'mut ref' binding in a pattern is not allowed in spec mode")
23782378
}
23792379

23802380
test_verify_one_file_with_options! {
@@ -2393,7 +2393,7 @@ test_verify_one_file_with_options! {
23932393
}
23942394
}
23952395
}
2396-
} => Err(err) => assert_vir_error_msg(err, "a 'mut ref' binding in a pattern is only allowed for exec mode")
2396+
} => Err(err) => assert_vir_error_msg(err, "a 'mut ref' binding in a pattern is not allowed in spec mode")
23972397
}
23982398

23992399
test_verify_one_file_with_options! {
@@ -2402,13 +2402,13 @@ test_verify_one_file_with_options! {
24022402
tracked a: u64
24032403
}
24042404

2405-
proof fn test(tracked x: X) {
2405+
proof fn test(tracked mut x: X) {
24062406
match x {
24072407
X { a: ref mut y } => {
24082408
}
24092409
}
24102410
}
2411-
} => Err(err) => assert_vir_error_msg(err, "a 'mut ref' binding in a pattern is only allowed for exec mode")
2411+
} => Ok(())
24122412
}
24132413

24142414
test_verify_one_file_with_options! {
@@ -2421,13 +2421,13 @@ test_verify_one_file_with_options! {
24212421
tracked x: X
24222422
}
24232423

2424-
proof fn test(tracked y: Y) {
2424+
proof fn test(tracked mut y: Y) {
24252425
match y {
24262426
Y { x: ref mut x0 @ X { a: _ } } => {
24272427
}
24282428
}
24292429
}
2430-
} => Err(err) => assert_vir_error_msg(err, "a 'mut ref' binding in a pattern is only allowed for exec mode")
2430+
} => Ok(())
24312431
}
24322432

24332433
test_verify_one_file_with_options! {
@@ -2464,7 +2464,7 @@ test_verify_one_file_with_options! {
24642464
Opt::None => { }
24652465
}
24662466
}
2467-
} => Err(err) => assert_vir_error_msg(err, "a 'mut ref' binding in a pattern is only allowed for exec mode")
2467+
} => Err(err) => assert_vir_error_msg(err, "a 'mut ref' binding in a pattern is not allowed in spec mode")
24682468
}
24692469

24702470
test_verify_one_file_with_options! {

source/vir/src/modes.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,12 +1026,11 @@ fn add_pattern_rec(
10261026

10271027
fn check_binding(span: &Span, by_ref: &ByRef, mode: Mode) -> Result<(), VirErr> {
10281028
match (by_ref, mode) {
1029-
(ByRef::MutRef, Mode::Spec | Mode::Proof) => {
1030-
// Supporting this for Mode::Proof would be nice but requires thought for how
1031-
// to implement.
1032-
Err(error(span, "a 'mut ref' binding in a pattern is only allowed for exec mode"))
1029+
(ByRef::MutRef, Mode::Spec) => {
1030+
Err(error(span, "a 'mut ref' binding in a pattern is not allowed in spec mode"))
10331031
}
10341032
(ByRef::No | ByRef::ImmutRef, _) => Ok(()),
1033+
(_, Mode::Proof) => Ok(()),
10351034
(_, Mode::Exec) => Ok(()),
10361035
}
10371036
}

0 commit comments

Comments
 (0)