2017-12-10 13:47:55 -06:00
|
|
|
error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/regions-nested-fns-2.rs:6:9
|
2017-12-10 13:47:55 -06:00
|
|
|
|
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | |z| {
|
2017-12-10 13:47:55 -06:00
|
|
|
| ^^^ may outlive borrowed value `y`
|
2019-03-09 06:03:44 -06:00
|
|
|
LL |
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | if false { &y } else { z }
|
2017-12-10 13:47:55 -06:00
|
|
|
| - `y` is borrowed here
|
|
|
|
help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
|
|
|
|
|
|
2018-02-24 17:01:39 -06:00
|
|
|
LL | move |z| {
|
2017-12-10 13:47:55 -06:00
|
|
|
| ^^^^^^^^
|
|
|
|
|
|
|
|
error: aborting due to previous error
|
|
|
|
|
2018-03-03 08:59:40 -06:00
|
|
|
For more information about this error, try `rustc --explain E0373`.
|