]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/issue-45983.nll.stderr
Auto merge of #53190 - sekineh:thumb-cortex-m, r=jamesmunns
[rust.git] / src / test / ui / borrowck / issue-45983.nll.stderr
1 warning: not reporting region error due to nll
2   --> $DIR/issue-45983.rs:36:27
3    |
4 LL |     give_any(|y| x = Some(y));
5    |                           ^
6
7 error: borrowed data escapes outside of closure
8   --> $DIR/issue-45983.rs:36:18
9    |
10 LL |     let x = None;
11    |         - `x` is declared here, outside of the closure body
12 LL |     give_any(|y| x = Some(y));
13    |               -  ^^^^^^^^^^^ `y` escapes the closure body here
14    |               |
15    |               `y` is a reference that is only valid in the closure body
16
17 error[E0594]: cannot assign to `x`, as it is not declared as mutable
18   --> $DIR/issue-45983.rs:36:18
19    |
20 LL |     let x = None;
21    |         - help: consider changing this to be mutable: `mut x`
22 LL |     give_any(|y| x = Some(y));
23    |                  ^^^^^^^^^^^ cannot assign
24
25 error: aborting due to 2 previous errors
26
27 For more information about this error, try `rustc --explain E0594`.