fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #68568 - pietroalbini:stable-next, r=pietroalbini5e1a799842b

1.41.0
3.0 KiB84 linesraw
1error[E0502]: cannot borrow `*f` as immutable because it is also borrowed as mutable
2  --> $DIR/borrowck-overloaded-index-autoderef.rs:37:14
3   |
4LL |     let p = &mut f[&s];
5   |                  - mutable borrow occurs here
6LL |     let q = &f[&s];
7   |              ^ immutable borrow occurs here
8LL |     p.use_mut();
9   |     - mutable borrow later used here
10
11error[E0499]: cannot borrow `*f` as mutable more than once at a time
12  --> $DIR/borrowck-overloaded-index-autoderef.rs:43:18
13   |
14LL |     let p = &mut f[&s];
15   |                  - first mutable borrow occurs here
16LL |     let q = &mut f[&s];
17   |                  ^ second mutable borrow occurs here
18LL |     p.use_mut();
19   |     - first borrow later used here
20
21error[E0499]: cannot borrow `f.foo` as mutable more than once at a time
22  --> $DIR/borrowck-overloaded-index-autoderef.rs:53:18
23   |
24LL |     let p = &mut f.foo[&s];
25   |                  ----- first mutable borrow occurs here
26LL |     let q = &mut f.foo[&s];
27   |                  ^^^^^ second mutable borrow occurs here
28LL |     p.use_mut();
29   |     - first borrow later used here
30
31error[E0502]: cannot borrow `f.foo` as mutable because it is also borrowed as immutable
32  --> $DIR/borrowck-overloaded-index-autoderef.rs:65:18
33   |
34LL |     let p = &f.foo[&s];
35   |              ----- immutable borrow occurs here
36LL |     let q = &mut f.foo[&s];
37   |                  ^^^^^ mutable borrow occurs here
38LL |     p.use_ref();
39   |     - immutable borrow later used here
40
41error[E0506]: cannot assign to `f.foo` because it is borrowed
42  --> $DIR/borrowck-overloaded-index-autoderef.rs:71:5
43   |
44LL |     let p = &f.foo[&s];
45   |              ----- borrow of `f.foo` occurs here
46LL |     f.foo = g;
47   |     ^^^^^^^^^ assignment to borrowed `f.foo` occurs here
48LL |     p.use_ref();
49   |     - borrow later used here
50
51error[E0506]: cannot assign to `*f` because it is borrowed
52  --> $DIR/borrowck-overloaded-index-autoderef.rs:77:5
53   |
54LL |     let p = &f.foo[&s];
55   |              ----- borrow of `*f` occurs here
56LL |     *f = g;
57   |     ^^^^^^ assignment to borrowed `*f` occurs here
58LL |     p.use_ref();
59   |     - borrow later used here
60
61error[E0506]: cannot assign to `f.foo` because it is borrowed
62  --> $DIR/borrowck-overloaded-index-autoderef.rs:83:5
63   |
64LL |     let p = &mut f.foo[&s];
65   |                  ----- borrow of `f.foo` occurs here
66LL |     f.foo = g;
67   |     ^^^^^^^^^ assignment to borrowed `f.foo` occurs here
68LL |     p.use_mut();
69   |     - borrow later used here
70
71error[E0506]: cannot assign to `*f` because it is borrowed
72  --> $DIR/borrowck-overloaded-index-autoderef.rs:89:5
73   |
74LL |     let p = &mut f.foo[&s];
75   |                  ----- borrow of `*f` occurs here
76LL |     *f = g;
77   |     ^^^^^^ assignment to borrowed `*f` occurs here
78LL |     p.use_mut();
79   |     - borrow later used here
80
81error: aborting due to 8 previous errors
82
83Some errors have detailed explanations: E0499, E0502, E0506.
84For more information about an error, try `rustc --explain E0499`.