fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
771 B21 linesraw
1error[E0521]: borrowed data escapes outside of closure
2  --> $DIR/issue-45983.rs:20:18
3   |
4LL |     let x = None;
5   |         - `x` declared here, outside of the closure body
6LL |     give_any(|y| x = Some(y));
7   |               -  ^^^^^^^^^^^ `y` escapes the closure body here
8   |               |
9   |               `y` is a reference that is only valid in the closure body
10
11error[E0594]: cannot assign to `x`, as it is not declared as mutable
12  --> $DIR/issue-45983.rs:20:18
13   |
14LL |     let x = None;
15   |         - help: consider changing this to be mutable: `mut x`
16LL |     give_any(|y| x = Some(y));
17   |                  ^^^^^^^^^^^ cannot assign
18
19error: aborting due to 2 previous errors
20
21For more information about this error, try `rustc --explain E0594`.