Closed jaybosamiya-ms closed 1 week ago
Can you briefly summarize what was the test failure we were seeing and how it was fixed? Thanks!
It was an issue of functions/closures/funspec. In particular, throwing away the passed-in-argument via _
is considered an advanced pattern by Verus (in the style of general parameter pattern binds, such as (a, b)
or such), and thus not available in spec land, but we can just bind it to an unused variable (_x
), which lets it go through.
Essentially, the code change:
- $crate::vstd::seq::Seq::new($n, |_| $elem)
+ $crate::vstd::prelude::closure_to_fn_spec(|_x: _| $elem),
The error message was confusing for a while, but once I realized that the issue was the _
, and switched it to _x
, it was much more straightforward to realize that I also needed to wrap it with the closure_to_fn_spec
Aha! Thanks for the explanation.
Finishes off one of the tasks on https://github.com/verus-lang/verus/discussions/1176?sort=top#discussioncomment-9875969