You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The vec function has the correct signature. The iter signature is weaker
(it does not pass the accumulator by value but rather by reference). This
is partly because, in the generic iter case, you cannot safely write the
vec signature. The compiler isn't smart enough to permit the moves (it fears
recursion). One option might be to pass in &mut, or else have iter::foldl use
a bit of unsafe code. But anyway this sounds like a separate issue.
This snippet works:
Changing to the following doesn't compile because it gets inferred as an @ closure:
Error:
The full code is in this repo.
The text was updated successfully, but these errors were encountered: