blob: 924eac6fdd41e978cf9b0cf0fb42b4876c09cc25 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
--> $DIR/regions-nested-fns-2.rs:6:9
|
LL | |z| {
| ^^^ may outlive borrowed value `y`
LL | //~^ ERROR E0373
LL | if false { &y } else { z }
| - `y` is borrowed here
help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
|
LL | move |z| {
| ^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0373`.
|