error[E0597]: `val` does not live long enough
--> src/tests/fail/timed_handler_closure_capture_too_short.rs:10:5
|
6 | let mut val = 0;
| ------- binding `val` declared here
...
9 | |_, _| {
| ------ value captured here
10 | val = 1;
| ^^^ borrowed value does not live long enough
...
15 | conn
| ---- a temporary with access to the borrow is created here ...
16 | };
| -- ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `Connection`
| |
| `val` dropped here while still borrowed
|
help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
|
15 | conn;
| +