error[E0597]: `handler` does not live long enough
--> src/tests/fail/id_handler_too_short.rs:7:23
|
6 | let handler = |_: &Context, _: &mut Connection, _: &Stanza| HandlerResult::RemoveHandler;
| ------- binding `handler` declared here
7 | conn.id_handler_add(&handler, "id");
| ^^^^^^^^ borrowed value does not live long enough
8 | conn
| ---- a temporary with access to the borrow is created here ...
9 | };
| -- ... 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
|
8 | conn;
| +