Skip to content

Commit baa0828

Browse files
committed
Fix --compare-mode=nll tests
1 parent 29e8e63 commit baa0828

File tree

49 files changed

+493
-139
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+493
-139
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
error[E0382]: use of moved value: `lhs`
2+
--> $DIR/binop-consume-args.rs:7:10
3+
|
4+
LL | fn add<A: Add<B, Output=()>, B>(lhs: A, rhs: B) {
5+
| - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
6+
| |
7+
| consider adding a `Copy` constraint to this type argument
8+
LL | lhs + rhs;
9+
| --- value moved here
10+
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
11+
| ^^^ value used here after move
12+
13+
error[E0382]: use of moved value: `rhs`
14+
--> $DIR/binop-consume-args.rs:8:10
15+
|
16+
LL | fn add<A: Add<B, Output=()>, B>(lhs: A, rhs: B) {
17+
| - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
18+
| |
19+
| consider adding a `Copy` constraint to this type argument
20+
LL | lhs + rhs;
21+
| --- value moved here
22+
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
23+
LL | drop(rhs); //~ ERROR use of moved value: `rhs`
24+
| ^^^ value used here after move
25+
26+
error[E0382]: use of moved value: `lhs`
27+
--> $DIR/binop-consume-args.rs:13:10
28+
|
29+
LL | fn sub<A: Sub<B, Output=()>, B>(lhs: A, rhs: B) {
30+
| - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
31+
| |
32+
| consider adding a `Copy` constraint to this type argument
33+
LL | lhs - rhs;
34+
| --- value moved here
35+
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
36+
| ^^^ value used here after move
37+
38+
error[E0382]: use of moved value: `rhs`
39+
--> $DIR/binop-consume-args.rs:14:10
40+
|
41+
LL | fn sub<A: Sub<B, Output=()>, B>(lhs: A, rhs: B) {
42+
| - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
43+
| |
44+
| consider adding a `Copy` constraint to this type argument
45+
LL | lhs - rhs;
46+
| --- value moved here
47+
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
48+
LL | drop(rhs); //~ ERROR use of moved value: `rhs`
49+
| ^^^ value used here after move
50+
51+
error[E0382]: use of moved value: `lhs`
52+
--> $DIR/binop-consume-args.rs:19:10
53+
|
54+
LL | fn mul<A: Mul<B, Output=()>, B>(lhs: A, rhs: B) {
55+
| - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
56+
| |
57+
| consider adding a `Copy` constraint to this type argument
58+
LL | lhs * rhs;
59+
| --- value moved here
60+
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
61+
| ^^^ value used here after move
62+
63+
error[E0382]: use of moved value: `rhs`
64+
--> $DIR/binop-consume-args.rs:20:10
65+
|
66+
LL | fn mul<A: Mul<B, Output=()>, B>(lhs: A, rhs: B) {
67+
| - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
68+
| |
69+
| consider adding a `Copy` constraint to this type argument
70+
LL | lhs * rhs;
71+
| --- value moved here
72+
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
73+
LL | drop(rhs); //~ ERROR use of moved value: `rhs`
74+
| ^^^ value used here after move
75+
76+
error[E0382]: use of moved value: `lhs`
77+
--> $DIR/binop-consume-args.rs:25:10
78+
|
79+
LL | fn div<A: Div<B, Output=()>, B>(lhs: A, rhs: B) {
80+
| - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
81+
| |
82+
| consider adding a `Copy` constraint to this type argument
83+
LL | lhs / rhs;
84+
| --- value moved here
85+
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
86+
| ^^^ value used here after move
87+
88+
error[E0382]: use of moved value: `rhs`
89+
--> $DIR/binop-consume-args.rs:26:10
90+
|
91+
LL | fn div<A: Div<B, Output=()>, B>(lhs: A, rhs: B) {
92+
| - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
93+
| |
94+
| consider adding a `Copy` constraint to this type argument
95+
LL | lhs / rhs;
96+
| --- value moved here
97+
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
98+
LL | drop(rhs); //~ ERROR use of moved value: `rhs`
99+
| ^^^ value used here after move
100+
101+
error[E0382]: use of moved value: `lhs`
102+
--> $DIR/binop-consume-args.rs:31:10
103+
|
104+
LL | fn rem<A: Rem<B, Output=()>, B>(lhs: A, rhs: B) {
105+
| - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
106+
| |
107+
| consider adding a `Copy` constraint to this type argument
108+
LL | lhs % rhs;
109+
| --- value moved here
110+
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
111+
| ^^^ value used here after move
112+
113+
error[E0382]: use of moved value: `rhs`
114+
--> $DIR/binop-consume-args.rs:32:10
115+
|
116+
LL | fn rem<A: Rem<B, Output=()>, B>(lhs: A, rhs: B) {
117+
| - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
118+
| |
119+
| consider adding a `Copy` constraint to this type argument
120+
LL | lhs % rhs;
121+
| --- value moved here
122+
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
123+
LL | drop(rhs); //~ ERROR use of moved value: `rhs`
124+
| ^^^ value used here after move
125+
126+
error[E0382]: use of moved value: `lhs`
127+
--> $DIR/binop-consume-args.rs:37:10
128+
|
129+
LL | fn bitand<A: BitAnd<B, Output=()>, B>(lhs: A, rhs: B) {
130+
| - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
131+
| |
132+
| consider adding a `Copy` constraint to this type argument
133+
LL | lhs & rhs;
134+
| --- value moved here
135+
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
136+
| ^^^ value used here after move
137+
138+
error[E0382]: use of moved value: `rhs`
139+
--> $DIR/binop-consume-args.rs:38:10
140+
|
141+
LL | fn bitand<A: BitAnd<B, Output=()>, B>(lhs: A, rhs: B) {
142+
| - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
143+
| |
144+
| consider adding a `Copy` constraint to this type argument
145+
LL | lhs & rhs;
146+
| --- value moved here
147+
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
148+
LL | drop(rhs); //~ ERROR use of moved value: `rhs`
149+
| ^^^ value used here after move
150+
151+
error[E0382]: use of moved value: `lhs`
152+
--> $DIR/binop-consume-args.rs:43:10
153+
|
154+
LL | fn bitor<A: BitOr<B, Output=()>, B>(lhs: A, rhs: B) {
155+
| - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
156+
| |
157+
| consider adding a `Copy` constraint to this type argument
158+
LL | lhs | rhs;
159+
| --- value moved here
160+
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
161+
| ^^^ value used here after move
162+
163+
error[E0382]: use of moved value: `rhs`
164+
--> $DIR/binop-consume-args.rs:44:10
165+
|
166+
LL | fn bitor<A: BitOr<B, Output=()>, B>(lhs: A, rhs: B) {
167+
| - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
168+
| |
169+
| consider adding a `Copy` constraint to this type argument
170+
LL | lhs | rhs;
171+
| --- value moved here
172+
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
173+
LL | drop(rhs); //~ ERROR use of moved value: `rhs`
174+
| ^^^ value used here after move
175+
176+
error[E0382]: use of moved value: `lhs`
177+
--> $DIR/binop-consume-args.rs:49:10
178+
|
179+
LL | fn bitxor<A: BitXor<B, Output=()>, B>(lhs: A, rhs: B) {
180+
| - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
181+
| |
182+
| consider adding a `Copy` constraint to this type argument
183+
LL | lhs ^ rhs;
184+
| --- value moved here
185+
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
186+
| ^^^ value used here after move
187+
188+
error[E0382]: use of moved value: `rhs`
189+
--> $DIR/binop-consume-args.rs:50:10
190+
|
191+
LL | fn bitxor<A: BitXor<B, Output=()>, B>(lhs: A, rhs: B) {
192+
| - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
193+
| |
194+
| consider adding a `Copy` constraint to this type argument
195+
LL | lhs ^ rhs;
196+
| --- value moved here
197+
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
198+
LL | drop(rhs); //~ ERROR use of moved value: `rhs`
199+
| ^^^ value used here after move
200+
201+
error[E0382]: use of moved value: `lhs`
202+
--> $DIR/binop-consume-args.rs:55:10
203+
|
204+
LL | fn shl<A: Shl<B, Output=()>, B>(lhs: A, rhs: B) {
205+
| - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
206+
| |
207+
| consider adding a `Copy` constraint to this type argument
208+
LL | lhs << rhs;
209+
| --- value moved here
210+
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
211+
| ^^^ value used here after move
212+
213+
error[E0382]: use of moved value: `rhs`
214+
--> $DIR/binop-consume-args.rs:56:10
215+
|
216+
LL | fn shl<A: Shl<B, Output=()>, B>(lhs: A, rhs: B) {
217+
| - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
218+
| |
219+
| consider adding a `Copy` constraint to this type argument
220+
LL | lhs << rhs;
221+
| --- value moved here
222+
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
223+
LL | drop(rhs); //~ ERROR use of moved value: `rhs`
224+
| ^^^ value used here after move
225+
226+
error[E0382]: use of moved value: `lhs`
227+
--> $DIR/binop-consume-args.rs:61:10
228+
|
229+
LL | fn shr<A: Shr<B, Output=()>, B>(lhs: A, rhs: B) {
230+
| - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
231+
| |
232+
| consider adding a `Copy` constraint to this type argument
233+
LL | lhs >> rhs;
234+
| --- value moved here
235+
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
236+
| ^^^ value used here after move
237+
238+
error[E0382]: use of moved value: `rhs`
239+
--> $DIR/binop-consume-args.rs:62:10
240+
|
241+
LL | fn shr<A: Shr<B, Output=()>, B>(lhs: A, rhs: B) {
242+
| - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
243+
| |
244+
| consider adding a `Copy` constraint to this type argument
245+
LL | lhs >> rhs;
246+
| --- value moved here
247+
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
248+
LL | drop(rhs); //~ ERROR use of moved value: `rhs`
249+
| ^^^ value used here after move
250+
251+
error: aborting due to 20 previous errors
252+
253+
For more information about this error, try `rustc --explain E0382`.

src/test/ui/binop/binop-move-semantics.nll.stderr

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
11
error[E0382]: use of moved value: `x`
22
--> $DIR/binop-move-semantics.rs:8:5
33
|
4+
LL | fn double_move<T: Add<Output=()>>(x: T) {
5+
| - - move occurs because `x` has type `T`, which does not implement the `Copy` trait
6+
| |
7+
| consider adding a `Copy` constraint to this type argument
48
LL | x
59
| - value moved here
610
LL | +
711
LL | x; //~ ERROR: use of moved value
812
| ^ value used here after move
9-
|
10-
= note: move occurs because `x` has type `T`, which does not implement the `Copy` trait
1113

1214
error[E0382]: borrow of moved value: `x`
1315
--> $DIR/binop-move-semantics.rs:14:5
1416
|
17+
LL | fn move_then_borrow<T: Add<Output=()> + Clone>(x: T) {
18+
| - - move occurs because `x` has type `T`, which does not implement the `Copy` trait
19+
| |
20+
| consider adding a `Copy` constraint to this type argument
1521
LL | x
1622
| - value moved here
1723
LL | +
1824
LL | x.clone(); //~ ERROR: use of moved value
1925
| ^ value borrowed here after move
20-
|
21-
= note: move occurs because `x` has type `T`, which does not implement the `Copy` trait
2226

2327
error[E0505]: cannot move out of `x` because it is borrowed
2428
--> $DIR/binop-move-semantics.rs:21:5

src/test/ui/borrowck/borrowck-asm.ast.nll.stderr

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
error[E0382]: use of moved value: `x`
22
--> $DIR/borrowck-asm.rs:27:17
33
|
4+
LL | let x = &mut 0isize;
5+
| - move occurs because `x` has type `&mut isize`, which does not implement the `Copy` trait
6+
LL | unsafe {
47
LL | asm!("nop" : : "r"(x));
58
| - value moved here
69
LL | }
710
LL | let z = x; //[ast]~ ERROR use of moved value: `x`
811
| ^ value used here after move
9-
|
10-
= note: move occurs because `x` has type `&mut isize`, which does not implement the `Copy` trait
1112

1213
error[E0503]: cannot use `x` because it was mutably borrowed
1314
--> $DIR/borrowck-asm.rs:35:32
@@ -66,12 +67,13 @@ LL | let z = y;
6667
error[E0382]: use of moved value: `x`
6768
--> $DIR/borrowck-asm.rs:86:40
6869
|
70+
LL | let x = &mut 2;
71+
| - move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait
72+
LL | unsafe {
6973
LL | asm!("nop" : : "r"(x), "r"(x) ); //[ast]~ ERROR use of moved value
7074
| - ^ value used here after move
7175
| |
7276
| value moved here
73-
|
74-
= note: move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait
7577

7678
error: aborting due to 7 previous errors
7779

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error[E0382]: use of moved value: `b`
2+
--> $DIR/borrowck-consume-unsize-vec.rs:8:13
3+
|
4+
LL | fn foo(b: Box<[i32;5]>) {
5+
| - move occurs because `b` has type `std::boxed::Box<[i32; 5]>`, which does not implement the `Copy` trait
6+
LL | consume(b);
7+
| - value moved here
8+
LL | consume(b); //~ ERROR use of moved value
9+
| ^ value used here after move
10+
11+
error: aborting due to previous error
12+
13+
For more information about this error, try `rustc --explain E0382`.

src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
error[E0382]: use of moved value: `b`
22
--> $DIR/borrowck-consume-upcast-box.rs:10:13
33
|
4+
LL | fn foo(b: Box<Foo+Send>) {
5+
| - move occurs because `b` has type `std::boxed::Box<dyn Foo + std::marker::Send>`, which does not implement the `Copy` trait
46
LL | consume(b);
57
| - value moved here
68
LL | consume(b); //~ ERROR use of moved value
79
| ^ value used here after move
8-
|
9-
= note: move occurs because `b` has type `std::boxed::Box<dyn Foo + std::marker::Send>`, which does not implement the `Copy` trait
1010

1111
error: aborting due to previous error
1212

src/test/ui/borrowck/borrowck-loan-in-overloaded-op.nll.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
error[E0382]: borrow of moved value: `x`
22
--> $DIR/borrowck-loan-in-overloaded-op.rs:21:20
33
|
4+
LL | let x = Foo(box 3);
5+
| - move occurs because `x` has type `Foo`, which does not implement the `Copy` trait
46
LL | let _y = {x} + x.clone(); // the `{x}` forces a move to occur
57
| - ^ value borrowed here after move
68
| |
79
| value moved here
8-
|
9-
= note: move occurs because `x` has type `Foo`, which does not implement the `Copy` trait
1010

1111
error: aborting due to previous error
1212

src/test/ui/borrowck/borrowck-move-moved-value-into-closure.ast.nll.stderr

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
error[E0382]: use of moved value: `t`
22
--> $DIR/borrowck-move-moved-value-into-closure.rs:14:12
33
|
4+
LL | let t: Box<_> = box 3;
5+
| - move occurs because `t` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
6+
LL |
47
LL | call_f(move|| { *t + 1 });
58
| ------ - variable moved due to use in closure
69
| |
@@ -9,8 +12,6 @@ LL | call_f(move|| { *t + 1 }); //[ast]~ ERROR capture of moved value
912
| ^^^^^^ - use occurs due to use in closure
1013
| |
1114
| value used here after move
12-
|
13-
= note: move occurs because `t` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
1415

1516
error: aborting due to previous error
1617

0 commit comments

Comments
 (0)