fork/rust

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

borsAuto merge of #71868 - Mark-Simulacrum:stable-1.43.1, r=pietroalbini8d69840ab92

1.43.1
2.1 KiB65 linesraw
1error[E0505]: cannot move out of `x` because it is borrowed
2  --> $DIR/borrow-tuple-fields.rs:12:13
3   |
4LL |     let r = &x.0;
5   |             ---- borrow of `x.0` occurs here
6LL |     let y = x;
7   |             ^ move out of `x` occurs here
8LL | 
9LL |     r.use_ref();
10   |     - borrow later used here
11
12error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
13  --> $DIR/borrow-tuple-fields.rs:18:13
14   |
15LL |     let a = &x.0;
16   |             ---- immutable borrow occurs here
17LL |     let b = &mut x.0;
18   |             ^^^^^^^^ mutable borrow occurs here
19LL |     a.use_ref();
20   |     - immutable borrow later used here
21
22error[E0499]: cannot borrow `x.0` as mutable more than once at a time
23  --> $DIR/borrow-tuple-fields.rs:23:13
24   |
25LL |     let a = &mut x.0;
26   |             -------- first mutable borrow occurs here
27LL |     let b = &mut x.0;
28   |             ^^^^^^^^ second mutable borrow occurs here
29LL |     a.use_ref();
30   |     - first borrow later used here
31
32error[E0505]: cannot move out of `x` because it is borrowed
33  --> $DIR/borrow-tuple-fields.rs:28:13
34   |
35LL |     let r = &x.0;
36   |             ---- borrow of `x.0` occurs here
37LL |     let y = x;
38   |             ^ move out of `x` occurs here
39LL |     r.use_ref();
40   |     - borrow later used here
41
42error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
43  --> $DIR/borrow-tuple-fields.rs:33:13
44   |
45LL |     let a = &x.0;
46   |             ---- immutable borrow occurs here
47LL |     let b = &mut x.0;
48   |             ^^^^^^^^ mutable borrow occurs here
49LL |     a.use_ref();
50   |     - immutable borrow later used here
51
52error[E0499]: cannot borrow `x.0` as mutable more than once at a time
53  --> $DIR/borrow-tuple-fields.rs:38:13
54   |
55LL |     let a = &mut x.0;
56   |             -------- first mutable borrow occurs here
57LL |     let b = &mut x.0;
58   |             ^^^^^^^^ second mutable borrow occurs here
59LL |     a.use_mut();
60   |     - first borrow later used here
61
62error: aborting due to 6 previous errors
63
64Some errors have detailed explanations: E0499, E0502, E0505.
65For more information about an error, try `rustc --explain E0499`.