Skip to content

FnMut closures with captured mutable slice #1395

Answered by jhjourdan
ia0 asked this question in Help
Discussion options

You must be logged in to vote

Both questions have the same answer: you should add #[ensures(i == old(i))] as an additional postcondition, or not use any specification (i.e., use closure specification inference).

The reason is that because of the move keyword, the variable i in the closure (and its specification) is really a different object than the variable i in the outer function.

Replies: 2 comments 15 replies

Comment options

You must be logged in to vote
15 replies
@jhjourdan
Comment options

@jhjourdan
Comment options

@ia0
Comment options

@jhjourdan
Comment options

@ia0
Comment options

Answer selected by ia0
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants