2018-10-03 15:47:23 +00:00
error[E0597]: `stmt` does not live long enough
2019-04-22 07:40:08 +00:00
--> $DIR/issue-54556-stephaneyfx.rs:27:21
2018-10-03 15:47:23 +00:00
|
2023-01-15 03:06:44 +00:00
LL | let stmt = Statement;
| ---- binding `stmt` declared here
2019-03-09 12:03:44 +00:00
LL | let rows = Rows(&stmt);
2019-04-22 07:40:08 +00:00
| ^^^^^ borrowed value does not live long enough
LL | rows.map(|row| row).next()
| ------------------- a temporary with access to the borrow is created here ...
2018-10-03 15:47:23 +00:00
...
LL | }
2019-04-22 07:40:08 +00:00
| -
| |
| `stmt` dropped here while still borrowed
2023-09-09 06:36:50 +00:00
| ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `Map<Rows<'_>, {closure@$DIR/issue-54556-stephaneyfx.rs:28:14: 28:19}>`
2018-10-03 15:47:23 +00:00
|
2020-04-16 19:43:40 +00:00
= note: the temporary is part of an expression at the end of a block;
consider forcing this temporary to be dropped sooner, before the block's local variables are dropped
help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block
|
LL | let x = rows.map(|row| row).next(); x
2021-06-22 02:07:19 +00:00
| +++++++ +++
2018-10-03 15:47:23 +00:00
2023-11-21 15:44:16 +00:00
error: aborting due to 1 previous error
2018-10-03 15:47:23 +00:00
For more information about this error, try `rustc --explain E0597`.