error[E0597]: `val` does not live long enough
--> src/tests/fail/logger_closure_capture_too_short.rs:8:4
|
7 | Context::new(Logger::new(|_, _, _| {
| - --------- value captured here
| _________|
| |
8 | | val.fetch_add(1, Ordering::Relaxed);
| | ^^^ borrowed value does not live long enough
9 | | }))
| |___________- 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 `libstrophe::Context`
| |
| `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
|
9 | }));
| +