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