Skip to content

Commit

Permalink
Add support for lifetime_param
Browse files Browse the repository at this point in the history
  • Loading branch information
parno committed Nov 15, 2023
1 parent e947b8b commit d334227
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
16 changes: 2 additions & 14 deletions examples/wip.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
verus! {

struct StrictlyOrderedVec<K: KeyTrait> {
a: int,
fn get<'a>(&'a self) -> (o: Option<&'a V>) {
a
}

struct DelegationMap<
#[verifier(maybe_negative)]
K: KeyTrait + VerusClone,
> {
b: int,
}

impl<K: KeyTrait + VerusClone> DelegationMap<K> {
fn view() -> Map<K, AbstractEndPoint> {
c
}
}

} // verus!
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ fn to_doc<'a>(
Rule::generic_param => map_to_doc(ctx, arena, pair),
Rule::type_param => map_to_doc(ctx, arena, pair),
Rule::const_param => unsupported(pair),
Rule::lifetime_param => unsupported(pair),
Rule::lifetime_param => map_to_doc(ctx, arena, pair),
Rule::where_clause => unsupported(pair),
Rule::where_pred => unsupported(pair),
Rule::visibility => s.append(arena.space()),
Expand Down
23 changes: 23 additions & 0 deletions tests/snap-tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -808,3 +808,26 @@ pub fn clone_vec_u8() {
} // verus!
"###);
}

#[test]
fn verus_lifetimes() {
let file = r#"
verus! {
fn get<'a>(&'a self, k: &K) -> (o: Option<&'a V>) {
a
}
} // verus!
"#;

assert_snapshot!(parse_and_format(file).unwrap(), @r###"
verus! {
fn get<'a>(&'aself, k: &K) -> (o: Option<&'aV>) {
a
}
} // verus!
"###);
}

0 comments on commit d334227

Please sign in to comment.