]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr
Auto merge of #53002 - QuietMisdreavus:brother-may-i-have-some-loops, r=pnkfelix
[rust.git] / src / test / ui / borrowck / regions-escape-unboxed-closure.nll.stderr
1 warning: not reporting region error due to nll
2   --> $DIR/regions-escape-unboxed-closure.rs:16:27
3    |
4 LL |     with_int(&mut |y| x = Some(y));
5    |                           ^^^^^^^
6
7 error: borrowed data escapes outside of closure
8   --> $DIR/regions-escape-unboxed-closure.rs:16:23
9    |
10 LL |     let mut x: Option<&isize> = None;
11    |         ----- `x` is declared here, outside of the closure body
12 LL |     with_int(&mut |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: aborting due to previous error
18