blob: cb280880950043fa07ee9427c7a4ffddfeb5461f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
error[E0506]: cannot assign to `v[_]` because it is borrowed
--> $DIR/drop-no-may-dangle.rs:18:9
|
LL | let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] };
| ----- borrow of `v[_]` occurs here
...
LL | v[0] += 1;
| ^^^^^^^^^ assignment to borrowed `v[_]` occurs here
...
LL | }
| - borrow might be used here, when `p` is dropped and runs the `Drop` code for type `WrapMayNotDangle`
error[E0506]: cannot assign to `v[_]` because it is borrowed
--> $DIR/drop-no-may-dangle.rs:21:5
|
LL | let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] };
| ----- borrow of `v[_]` occurs here
...
LL | v[0] += 1;
| ^^^^^^^^^ assignment to borrowed `v[_]` occurs here
LL | }
| - borrow might be used here, when `p` is dropped and runs the `Drop` code for type `WrapMayNotDangle`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0506`.
|