rust/src/test/ui/regions/regions-nested-fns-2.stderr

17 lines
628 B
Plaintext
Raw Normal View History

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
|
2018-02-23 03:42:32 +03:00
LL | |z| {
| ^^^ 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 }
| - `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| {
| ^^^^^^^^
error: aborting due to previous error
2018-03-03 15:59:40 +01:00
For more information about this error, try `rustc --explain E0373`.