rust/src/test/ui/borrowck/regions-escape-bound-fn.stderr

13 lines
455 B
Plaintext
Raw Normal View History

2020-05-20 12:58:41 -05:00
error[E0521]: borrowed data escapes outside of closure
--> $DIR/regions-escape-bound-fn.rs:11:18
|
2018-02-22 18:42:32 -06:00
LL | let mut x: Option<&isize> = None;
2020-05-20 12:58:41 -05:00
| ----- `x` declared here, outside of the closure body
2018-02-22 18:42:32 -06:00
LL | with_int(|y| x = Some(y));
2020-05-20 12:58:41 -05:00
| - ^^^^^^^^^^^ `y` escapes the closure body here
| |
| `y` is a reference that is only valid in the closure body
error: aborting due to previous error