]> git.proxmox.com Git - rustc.git/blame - src/test/ui/closures/2229_closure_analysis/diagnostics/arrays.stderr
New upstream version 1.64.0+dfsg1
[rustc.git] / src / test / ui / closures / 2229_closure_analysis / diagnostics / arrays.stderr
CommitLineData
fc512014 1error[E0503]: cannot use `arr` because it was mutably borrowed
136023e0 2 --> $DIR/arrays.rs:14:5
fc512014
XL
3 |
4LL | let mut c = || {
5 | -- borrow of `arr` occurs here
6LL | arr[0] += 10;
7 | --- borrow occurs due to use of `arr` in closure
8...
9LL | arr[1] += 10;
10 | ^^^^^^ use of borrowed `arr`
11...
12LL | c();
13 | - borrow later used here
14
15error[E0503]: cannot use `arr[_]` because it was mutably borrowed
136023e0 16 --> $DIR/arrays.rs:14:5
fc512014
XL
17 |
18LL | let mut c = || {
19 | -- borrow of `arr` occurs here
20LL | arr[0] += 10;
21 | --- borrow occurs due to use of `arr` in closure
22...
23LL | arr[1] += 10;
24 | ^^^^^^^^^^^^ use of borrowed `arr`
25...
26LL | c();
27 | - borrow later used here
28
29error[E0506]: cannot assign to `arr[_]` because it is borrowed
136023e0 30 --> $DIR/arrays.rs:29:5
fc512014
XL
31 |
32LL | let c = || {
33 | -- borrow of `arr[_]` occurs here
34LL | println!("{:#?}", &arr[3..4]);
35 | --- borrow occurs due to use in closure
36...
37LL | arr[1] += 10;
38 | ^^^^^^^^^^^^ assignment to borrowed `arr[_]` occurs here
39LL |
40LL | c();
41 | - borrow later used here
42
43error[E0506]: cannot assign to `arr[_]` because it is borrowed
136023e0 44 --> $DIR/arrays.rs:43:5
fc512014
XL
45 |
46LL | let c = || {
47 | -- borrow of `arr[_]` occurs here
48LL | println!("{}", arr[3]);
49 | --- borrow occurs due to use in closure
50...
51LL | arr[1] += 10;
52 | ^^^^^^^^^^^^ assignment to borrowed `arr[_]` occurs here
53LL |
54LL | c();
55 | - borrow later used here
56
57error[E0503]: cannot use `arr` because it was mutably borrowed
136023e0 58 --> $DIR/arrays.rs:57:20
fc512014
XL
59 |
60LL | let mut c = || {
61 | -- borrow of `arr` occurs here
62LL | arr[1] += 10;
63 | --- borrow occurs due to use of `arr` in closure
64...
65LL | println!("{}", arr[3]);
66 | ^^^^^^ use of borrowed `arr`
67...
68LL | c();
69 | - borrow later used here
70
71error[E0502]: cannot borrow `arr[_]` as immutable because it is also borrowed as mutable
136023e0 72 --> $DIR/arrays.rs:57:20
fc512014
XL
73 |
74LL | let mut c = || {
75 | -- mutable borrow occurs here
76LL | arr[1] += 10;
77 | --- first borrow occurs due to use of `arr` in closure
78...
79LL | println!("{}", arr[3]);
80 | ^^^^^^ immutable borrow occurs here
81...
82LL | c();
83 | - mutable borrow later used here
a2a8927a 84 |
064997fb 85 = 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)
fc512014
XL
86
87error[E0502]: cannot borrow `arr` as immutable because it is also borrowed as mutable
136023e0 88 --> $DIR/arrays.rs:73:24
fc512014
XL
89 |
90LL | let mut c = || {
91 | -- mutable borrow occurs here
92LL | arr[1] += 10;
93 | --- first borrow occurs due to use of `arr` in closure
94...
95LL | println!("{:#?}", &arr[3..2]);
96 | ^^^ immutable borrow occurs here
97...
98LL | c();
99 | - mutable borrow later used here
100
136023e0 101error: aborting due to 7 previous errors
fc512014
XL
102
103Some errors have detailed explanations: E0502, E0503, E0506.
104For more information about an error, try `rustc --explain E0502`.