Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: What's going on in this closure?
I ran across a strange lifetime issue invloving higher-order functions in my code; I've prepared a minimum working example here. The issue is that, when do_for_each_file
is called with a reference to do_something
, this causes a lifetime error (implementation of `FnMut` is not general enough
), however if do_something
is instead wrapped in a closure and a reference to this closure is passed it does not. The functional programmer in me wants to eta-reduce that closure out, but clearly it is doing something implicit here, I'm guessing to do with lifetime coercion. Any help elucidating exactly what is going on here would be much appreciated.
2 posts - 2 participants
🏷️ rust_feed