2017-12-10 22:47:55 +03:00
|
|
|
error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/regions-nested-fns-2.rs:6:9
|
2017-12-10 22:47:55 +03:00
|
|
|
|
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | |z| {
|
2017-12-10 22:47:55 +03:00
|
|
|
| ^^^ may outlive borrowed value `y`
|
2018-02-25 02:01:39 +03:00
|
|
|
LL | //~^ ERROR E0373
|
2018-02-23 03:42:32 +03:00
|
|
|
LL | if false { &y } else { z }
|
2017-12-10 22:47:55 +03: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-25 02:01:39 +03:00
|
|
|
LL | move |z| {
|
2017-12-10 22:47:55 +03:00
|
|
|
| ^^^^^^^^
|
|
|
|
|
|
|
|
error: aborting due to previous error
|
|
|
|
|
2018-03-03 15:59:40 +01:00
|
|
|
For more information about this error, try `rustc --explain E0373`.
|