fork/rust

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

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
6.4 KiB173 linesraw
1error: cannot move out of value because it is borrowed
2  --> $DIR/borrowck-pat-at-and-box.rs:37:9
3   |
4LL |     let ref a @ box b = Box::new(NC);
5   |         -----^^^^^^^-
6   |         |           |
7   |         |           value moved into `b` here
8   |         value borrowed, by `a`, here
9
10error: cannot borrow value as mutable because it is also borrowed as immutable
11  --> $DIR/borrowck-pat-at-and-box.rs:39:9
12   |
13LL |     let ref a @ box ref mut b = Box::new(nc());
14   |         -----^^^^^^^---------
15   |         |           |
16   |         |           mutable borrow, by `b`, occurs here
17   |         immutable borrow, by `a`, occurs here
18
19error: cannot borrow value as mutable because it is also borrowed as immutable
20  --> $DIR/borrowck-pat-at-and-box.rs:41:9
21   |
22LL |     let ref a @ box ref mut b = Box::new(NC);
23   |         -----^^^^^^^---------
24   |         |           |
25   |         |           mutable borrow, by `b`, occurs here
26   |         immutable borrow, by `a`, occurs here
27
28error: cannot borrow value as mutable because it is also borrowed as immutable
29  --> $DIR/borrowck-pat-at-and-box.rs:43:9
30   |
31LL |     let ref a @ box ref mut b = Box::new(NC);
32   |         -----^^^^^^^---------
33   |         |           |
34   |         |           mutable borrow, by `b`, occurs here
35   |         immutable borrow, by `a`, occurs here
36
37error: cannot borrow value as mutable because it is also borrowed as immutable
38  --> $DIR/borrowck-pat-at-and-box.rs:46:9
39   |
40LL |     let ref a @ box ref mut b = Box::new(NC);
41   |         -----^^^^^^^---------
42   |         |           |
43   |         |           mutable borrow, by `b`, occurs here
44   |         immutable borrow, by `a`, occurs here
45
46error: cannot borrow value as immutable because it is also borrowed as mutable
47  --> $DIR/borrowck-pat-at-and-box.rs:52:9
48   |
49LL |     let ref mut a @ box ref b = Box::new(NC);
50   |         ---------^^^^^^^-----
51   |         |               |
52   |         |               immutable borrow, by `b`, occurs here
53   |         mutable borrow, by `a`, occurs here
54
55error: cannot borrow value as immutable because it is also borrowed as mutable
56  --> $DIR/borrowck-pat-at-and-box.rs:66:9
57   |
58LL |         ref mut a @ box ref b => {
59   |         ---------^^^^^^^-----
60   |         |               |
61   |         |               immutable borrow, by `b`, occurs here
62   |         mutable borrow, by `a`, occurs here
63
64error: cannot borrow value as immutable because it is also borrowed as mutable
65  --> $DIR/borrowck-pat-at-and-box.rs:58:11
66   |
67LL |     fn f5(ref mut a @ box ref b: Box<NC>) {
68   |           ---------^^^^^^^-----
69   |           |               |
70   |           |               immutable borrow, by `b`, occurs here
71   |           mutable borrow, by `a`, occurs here
72
73error[E0382]: use of moved value
74  --> $DIR/borrowck-pat-at-and-box.rs:21:18
75   |
76LL |     let a @ box &b = Box::new(&C);
77   |         ---------^   ------------ move occurs because value has type `std::boxed::Box<&C>`, which does not implement the `Copy` trait
78   |         |        |
79   |         |        value used here after move
80   |         value moved here
81
82error[E0382]: use of moved value
83  --> $DIR/borrowck-pat-at-and-box.rs:24:17
84   |
85LL |     let a @ box b = Box::new(C);
86   |         --------^   ----------- move occurs because value has type `std::boxed::Box<C>`, which does not implement the `Copy` trait
87   |         |       |
88   |         |       value used here after move
89   |         value moved here
90
91error[E0382]: use of moved value
92  --> $DIR/borrowck-pat-at-and-box.rs:34:17
93   |
94LL |     match Box::new(C) {
95   |           ----------- move occurs because value has type `std::boxed::Box<C>`, which does not implement the `Copy` trait
96LL |         a @ box b => {}
97   |         --------^
98   |         |       |
99   |         |       value used here after move
100   |         value moved here
101
102error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
103  --> $DIR/borrowck-pat-at-and-box.rs:46:21
104   |
105LL |     let ref a @ box ref mut b = Box::new(NC);
106   |         ------------^^^^^^^^^
107   |         |           |
108   |         |           mutable borrow occurs here
109   |         immutable borrow occurs here
110...
111LL |     drop(a);
112   |          - immutable borrow later used here
113
114error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
115  --> $DIR/borrowck-pat-at-and-box.rs:52:25
116   |
117LL |     let ref mut a @ box ref b = Box::new(NC);
118   |         ----------------^^^^^
119   |         |               |
120   |         |               immutable borrow occurs here
121   |         mutable borrow occurs here
122...
123LL |     *a = Box::new(NC);
124   |     -- mutable borrow later used here
125
126error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
127  --> $DIR/borrowck-pat-at-and-box.rs:66:25
128   |
129LL |         ref mut a @ box ref b => {
130   |         ----------------^^^^^
131   |         |               |
132   |         |               immutable borrow occurs here
133   |         mutable borrow occurs here
134...
135LL |             *a = Box::new(NC);
136   |             -- mutable borrow later used here
137
138error[E0382]: use of moved value
139  --> $DIR/borrowck-pat-at-and-box.rs:27:20
140   |
141LL |     fn f1(a @ box &b: Box<&C>) {}
142   |           ---------^
143   |           |        |
144   |           |        value used here after move
145   |           value moved here
146   |           move occurs because value has type `std::boxed::Box<&C>`, which does not implement the `Copy` trait
147
148error[E0382]: use of moved value
149  --> $DIR/borrowck-pat-at-and-box.rs:30:19
150   |
151LL |     fn f2(a @ box b: Box<C>) {}
152   |           --------^
153   |           |       |
154   |           |       value used here after move
155   |           value moved here
156   |           move occurs because value has type `std::boxed::Box<C>`, which does not implement the `Copy` trait
157
158error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
159  --> $DIR/borrowck-pat-at-and-box.rs:58:27
160   |
161LL |     fn f5(ref mut a @ box ref b: Box<NC>) {
162   |           ----------------^^^^^
163   |           |               |
164   |           |               immutable borrow occurs here
165   |           mutable borrow occurs here
166...
167LL |         *a = Box::new(NC);
168   |         -- mutable borrow later used here
169
170error: aborting due to 17 previous errors
171
172Some errors have detailed explanations: E0382, E0502.
173For more information about an error, try `rustc --explain E0382`.