error[E0597]: `handler` does not live long enough
--> src/tests/fail/timed_handler_too_short.rs:8:26
|
7 | let handler = |_: &Context, _: &mut Connection| HandlerResult::RemoveHandler;
| ------- binding `handler` declared here
8 | conn.timed_handler_add(&handler, Duration::from_secs(1));
| ^^^^^^^^ borrowed value does not live long enough
9 | conn
| ---- a temporary with access to the borrow is created here ...
10 | };
| -- ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `Connection`
| |
| `handler` 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
|
9 | conn;
| +