]> git.lizzy.rs Git - rust.git/blob - tests/ui/closures/2229_closure_analysis/diagnostics/box.stderr
Rollup merge of #107100 - compiler-errors:issue-107087, r=lcnr
[rust.git] / tests / ui / closures / 2229_closure_analysis / diagnostics / box.stderr
1 error[E0506]: cannot assign to `e.0.0.m.x` because it is borrowed
2   --> $DIR/box.rs:21:5
3    |
4 LL |     let mut c = || {
5    |                 -- `e.0.0.m.x` is borrowed here
6 LL |         e.0.0.m.x = format!("not-x");
7    |         --------- borrow occurs due to use in closure
8 ...
9 LL |     e.0.0.m.x = format!("not-x");
10    |     ^^^^^^^^^ `e.0.0.m.x` is assigned to here but it was already borrowed
11 LL |
12 LL |     c();
13    |     - borrow later used here
14
15 error[E0502]: cannot borrow `e.0.0.m.x` as immutable because it is also borrowed as mutable
16   --> $DIR/box.rs:38:20
17    |
18 LL |     let mut c = || {
19    |                 -- mutable borrow occurs here
20 LL |         e.0.0.m.x = format!("not-x");
21    |         --------- first borrow occurs due to use of `e.0.0.m.x` in closure
22 ...
23 LL |     println!("{}", e.0.0.m.x);
24    |                    ^^^^^^^^^ immutable borrow occurs here
25 LL |
26 LL |     c();
27    |     - mutable borrow later used here
28    |
29    = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
30
31 error[E0506]: cannot assign to `e.0.0.m.x` because it is borrowed
32   --> $DIR/box.rs:55:5
33    |
34 LL |     let c = || {
35    |             -- `e.0.0.m.x` is borrowed here
36 LL |         println!("{}", e.0.0.m.x);
37    |                        --------- borrow occurs due to use in closure
38 ...
39 LL |     e.0.0.m.x = format!("not-x");
40    |     ^^^^^^^^^ `e.0.0.m.x` is assigned to here but it was already borrowed
41 LL |
42 LL |     c();
43    |     - borrow later used here
44
45 error: aborting due to 3 previous errors
46
47 Some errors have detailed explanations: E0502, E0506.
48 For more information about an error, try `rustc --explain E0502`.