rust/src/test/ui/borrowck/issue-45983.nll.stderr
2018-12-25 21:08:33 -07:00

23 lines
808 B
Plaintext

error[E0521]: borrowed data escapes outside of closure
--> $DIR/issue-45983.rs:26:18
|
LL | let x = None;
| - `x` is declared here, outside of the closure body
LL | give_any(|y| x = Some(y));
| - ^^^^^^^^^^^ `y` escapes the closure body here
| |
| `y` is a reference that is only valid in the closure body
error[E0594]: cannot assign to `x`, as it is not declared as mutable
--> $DIR/issue-45983.rs:26:18
|
LL | let x = None;
| - help: consider changing this to be mutable: `mut x`
LL | give_any(|y| x = Some(y));
| ^^^^^^^^^^^ cannot assign
error: aborting due to 2 previous errors
Some errors occurred: E0521, E0594.
For more information about an error, try `rustc --explain E0521`.