]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrow-tuple-fields.stderr
Auto merge of #54720 - davidtwco:issue-51191, r=nikomatsakis
[rust.git] / src / test / ui / borrowck / borrow-tuple-fields.stderr
1 error[E0505]: cannot move out of `x` because it is borrowed
2   --> $DIR/borrow-tuple-fields.rs:22:9
3    |
4 LL |     let r = &x.0;
5    |              --- borrow of `x.0` occurs here
6 LL |     let y = x; //~ ERROR cannot move out of `x` because it is borrowed
7    |         ^ move out of `x` occurs here
8
9 error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
10   --> $DIR/borrow-tuple-fields.rs:28:18
11    |
12 LL |     let a = &x.0;
13    |              --- immutable borrow occurs here
14 LL |     let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as
15    |                  ^^^ mutable borrow occurs here
16 ...
17 LL | }
18    | - immutable borrow ends here
19
20 error[E0499]: cannot borrow `x.0` as mutable more than once at a time
21   --> $DIR/borrow-tuple-fields.rs:33:18
22    |
23 LL |     let a = &mut x.0;
24    |                  --- first mutable borrow occurs here
25 LL |     let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time
26    |                  ^^^ second mutable borrow occurs here
27 ...
28 LL | }
29    | - first borrow ends here
30
31 error[E0505]: cannot move out of `x` because it is borrowed
32   --> $DIR/borrow-tuple-fields.rs:38:9
33    |
34 LL |     let r = &x.0;
35    |              --- borrow of `x.0` occurs here
36 LL |     let y = x; //~ ERROR cannot move out of `x` because it is borrowed
37    |         ^ move out of `x` occurs here
38
39 error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
40   --> $DIR/borrow-tuple-fields.rs:43:18
41    |
42 LL |     let a = &x.0;
43    |              --- immutable borrow occurs here
44 LL |     let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as
45    |                  ^^^ mutable borrow occurs here
46 ...
47 LL | }
48    | - immutable borrow ends here
49
50 error[E0499]: cannot borrow `x.0` as mutable more than once at a time
51   --> $DIR/borrow-tuple-fields.rs:48:18
52    |
53 LL |     let a = &mut x.0;
54    |                  --- first mutable borrow occurs here
55 LL |     let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time
56    |                  ^^^ second mutable borrow occurs here
57 LL |     a.use_mut();
58 LL | }
59    | - first borrow ends here
60
61 error: aborting due to 6 previous errors
62
63 Some errors occurred: E0499, E0502, E0505.
64 For more information about an error, try `rustc --explain E0499`.