Skip to content

Commit

Permalink
impl_trait needs a space
Browse files Browse the repository at this point in the history
  • Loading branch information
parno committed Dec 18, 2023
1 parent a61f14b commit 8e82bd2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
25 changes: 12 additions & 13 deletions examples/wip.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
verus! {

global size_of usize == 4;

global size_of S == 8;

global size_of S<u64> == 8;

global size_of S<U> == 8;

global layout S is size == 8, align == 8;

global layout S<u64> is size == 16, align == 8;

global layout S<u32> is size == 8, align == 4;
impl AffinityFn {
pub fn new(f: impl Fn(ReplicaId) + 'static) -> Self {
Self{ f: Box::new(f)}
}
pub fn call(&self, rid: ReplicaId) {
(self.f)(rid)
}
}

} // verus!

/*
pub type ReplicaId = usize; // $line_count$Trusted$
*/
11 changes: 10 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,15 @@ fn to_doc<'a>(
Rule::fn_ptr_type => map_to_doc(ctx, arena, pair),
Rule::fn_trait_type => map_to_doc(ctx, arena, pair),
Rule::for_type => map_to_doc(ctx, arena, pair),
Rule::impl_trait_type => map_to_doc(ctx, arena, pair),
Rule::impl_trait_type =>
{
// We need to inject a space after the "impl"
arena
.concat(pair.into_inner().map(|p| match p.as_rule() {
Rule::impl_str => arena.text("impl "),
_ => to_doc(ctx, p, arena),
}))
}
Rule::dyn_trait_type => map_to_doc(ctx, arena, pair),
Rule::type_bound_list => map_to_doc(ctx, arena, pair),
Rule::type_bound => map_to_doc(ctx, arena, pair),
Expand Down Expand Up @@ -1061,6 +1069,7 @@ fn find_inline_comment_lines(s: &str) -> HashSet<usize> {
comment_lines.insert(line_num + 1);
}
}
println!("comment_lines = {:?}", comment_lines);
return comment_lines;
}

Expand Down

0 comments on commit 8e82bd2

Please sign in to comment.