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