Skip to content

Commit

Permalink
Fix --compare-mode=nll tests
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Jan 24, 2019
1 parent 29e8e63 commit baa0828
Show file tree
Hide file tree
Showing 49 changed files with 493 additions and 139 deletions.
253 changes: 253 additions & 0 deletions src/test/ui/binop/binop-consume-args.nll.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
error[E0382]: use of moved value: `lhs`
--> $DIR/binop-consume-args.rs:7:10
|
LL | fn add<A: Add<B, Output=()>, B>(lhs: A, rhs: B) {
| - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
| |
| consider adding a `Copy` constraint to this type argument
LL | lhs + rhs;
| --- value moved here
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
| ^^^ value used here after move

error[E0382]: use of moved value: `rhs`
--> $DIR/binop-consume-args.rs:8:10
|
LL | fn add<A: Add<B, Output=()>, B>(lhs: A, rhs: B) {
| - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
| |
| consider adding a `Copy` constraint to this type argument
LL | lhs + rhs;
| --- value moved here
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
LL | drop(rhs); //~ ERROR use of moved value: `rhs`
| ^^^ value used here after move

error[E0382]: use of moved value: `lhs`
--> $DIR/binop-consume-args.rs:13:10
|
LL | fn sub<A: Sub<B, Output=()>, B>(lhs: A, rhs: B) {
| - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
| |
| consider adding a `Copy` constraint to this type argument
LL | lhs - rhs;
| --- value moved here
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
| ^^^ value used here after move

error[E0382]: use of moved value: `rhs`
--> $DIR/binop-consume-args.rs:14:10
|
LL | fn sub<A: Sub<B, Output=()>, B>(lhs: A, rhs: B) {
| - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
| |
| consider adding a `Copy` constraint to this type argument
LL | lhs - rhs;
| --- value moved here
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
LL | drop(rhs); //~ ERROR use of moved value: `rhs`
| ^^^ value used here after move

error[E0382]: use of moved value: `lhs`
--> $DIR/binop-consume-args.rs:19:10
|
LL | fn mul<A: Mul<B, Output=()>, B>(lhs: A, rhs: B) {
| - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
| |
| consider adding a `Copy` constraint to this type argument
LL | lhs * rhs;
| --- value moved here
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
| ^^^ value used here after move

error[E0382]: use of moved value: `rhs`
--> $DIR/binop-consume-args.rs:20:10
|
LL | fn mul<A: Mul<B, Output=()>, B>(lhs: A, rhs: B) {
| - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
| |
| consider adding a `Copy` constraint to this type argument
LL | lhs * rhs;
| --- value moved here
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
LL | drop(rhs); //~ ERROR use of moved value: `rhs`
| ^^^ value used here after move

error[E0382]: use of moved value: `lhs`
--> $DIR/binop-consume-args.rs:25:10
|
LL | fn div<A: Div<B, Output=()>, B>(lhs: A, rhs: B) {
| - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
| |
| consider adding a `Copy` constraint to this type argument
LL | lhs / rhs;
| --- value moved here
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
| ^^^ value used here after move

error[E0382]: use of moved value: `rhs`
--> $DIR/binop-consume-args.rs:26:10
|
LL | fn div<A: Div<B, Output=()>, B>(lhs: A, rhs: B) {
| - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
| |
| consider adding a `Copy` constraint to this type argument
LL | lhs / rhs;
| --- value moved here
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
LL | drop(rhs); //~ ERROR use of moved value: `rhs`
| ^^^ value used here after move

error[E0382]: use of moved value: `lhs`
--> $DIR/binop-consume-args.rs:31:10
|
LL | fn rem<A: Rem<B, Output=()>, B>(lhs: A, rhs: B) {
| - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
| |
| consider adding a `Copy` constraint to this type argument
LL | lhs % rhs;
| --- value moved here
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
| ^^^ value used here after move

error[E0382]: use of moved value: `rhs`
--> $DIR/binop-consume-args.rs:32:10
|
LL | fn rem<A: Rem<B, Output=()>, B>(lhs: A, rhs: B) {
| - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
| |
| consider adding a `Copy` constraint to this type argument
LL | lhs % rhs;
| --- value moved here
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
LL | drop(rhs); //~ ERROR use of moved value: `rhs`
| ^^^ value used here after move

error[E0382]: use of moved value: `lhs`
--> $DIR/binop-consume-args.rs:37:10
|
LL | fn bitand<A: BitAnd<B, Output=()>, B>(lhs: A, rhs: B) {
| - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
| |
| consider adding a `Copy` constraint to this type argument
LL | lhs & rhs;
| --- value moved here
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
| ^^^ value used here after move

error[E0382]: use of moved value: `rhs`
--> $DIR/binop-consume-args.rs:38:10
|
LL | fn bitand<A: BitAnd<B, Output=()>, B>(lhs: A, rhs: B) {
| - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
| |
| consider adding a `Copy` constraint to this type argument
LL | lhs & rhs;
| --- value moved here
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
LL | drop(rhs); //~ ERROR use of moved value: `rhs`
| ^^^ value used here after move

error[E0382]: use of moved value: `lhs`
--> $DIR/binop-consume-args.rs:43:10
|
LL | fn bitor<A: BitOr<B, Output=()>, B>(lhs: A, rhs: B) {
| - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
| |
| consider adding a `Copy` constraint to this type argument
LL | lhs | rhs;
| --- value moved here
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
| ^^^ value used here after move

error[E0382]: use of moved value: `rhs`
--> $DIR/binop-consume-args.rs:44:10
|
LL | fn bitor<A: BitOr<B, Output=()>, B>(lhs: A, rhs: B) {
| - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
| |
| consider adding a `Copy` constraint to this type argument
LL | lhs | rhs;
| --- value moved here
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
LL | drop(rhs); //~ ERROR use of moved value: `rhs`
| ^^^ value used here after move

error[E0382]: use of moved value: `lhs`
--> $DIR/binop-consume-args.rs:49:10
|
LL | fn bitxor<A: BitXor<B, Output=()>, B>(lhs: A, rhs: B) {
| - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
| |
| consider adding a `Copy` constraint to this type argument
LL | lhs ^ rhs;
| --- value moved here
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
| ^^^ value used here after move

error[E0382]: use of moved value: `rhs`
--> $DIR/binop-consume-args.rs:50:10
|
LL | fn bitxor<A: BitXor<B, Output=()>, B>(lhs: A, rhs: B) {
| - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
| |
| consider adding a `Copy` constraint to this type argument
LL | lhs ^ rhs;
| --- value moved here
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
LL | drop(rhs); //~ ERROR use of moved value: `rhs`
| ^^^ value used here after move

error[E0382]: use of moved value: `lhs`
--> $DIR/binop-consume-args.rs:55:10
|
LL | fn shl<A: Shl<B, Output=()>, B>(lhs: A, rhs: B) {
| - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
| |
| consider adding a `Copy` constraint to this type argument
LL | lhs << rhs;
| --- value moved here
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
| ^^^ value used here after move

error[E0382]: use of moved value: `rhs`
--> $DIR/binop-consume-args.rs:56:10
|
LL | fn shl<A: Shl<B, Output=()>, B>(lhs: A, rhs: B) {
| - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
| |
| consider adding a `Copy` constraint to this type argument
LL | lhs << rhs;
| --- value moved here
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
LL | drop(rhs); //~ ERROR use of moved value: `rhs`
| ^^^ value used here after move

error[E0382]: use of moved value: `lhs`
--> $DIR/binop-consume-args.rs:61:10
|
LL | fn shr<A: Shr<B, Output=()>, B>(lhs: A, rhs: B) {
| - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
| |
| consider adding a `Copy` constraint to this type argument
LL | lhs >> rhs;
| --- value moved here
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
| ^^^ value used here after move

error[E0382]: use of moved value: `rhs`
--> $DIR/binop-consume-args.rs:62:10
|
LL | fn shr<A: Shr<B, Output=()>, B>(lhs: A, rhs: B) {
| - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
| |
| consider adding a `Copy` constraint to this type argument
LL | lhs >> rhs;
| --- value moved here
LL | drop(lhs); //~ ERROR use of moved value: `lhs`
LL | drop(rhs); //~ ERROR use of moved value: `rhs`
| ^^^ value used here after move

error: aborting due to 20 previous errors

For more information about this error, try `rustc --explain E0382`.
12 changes: 8 additions & 4 deletions src/test/ui/binop/binop-move-semantics.nll.stderr
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
error[E0382]: use of moved value: `x`
--> $DIR/binop-move-semantics.rs:8:5
|
LL | fn double_move<T: Add<Output=()>>(x: T) {
| - - move occurs because `x` has type `T`, which does not implement the `Copy` trait
| |
| consider adding a `Copy` constraint to this type argument
LL | x
| - value moved here
LL | +
LL | x; //~ ERROR: use of moved value
| ^ value used here after move
|
= note: move occurs because `x` has type `T`, which does not implement the `Copy` trait

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

error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/binop-move-semantics.rs:21:5
Expand Down
10 changes: 6 additions & 4 deletions src/test/ui/borrowck/borrowck-asm.ast.nll.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
error[E0382]: use of moved value: `x`
--> $DIR/borrowck-asm.rs:27:17
|
LL | let x = &mut 0isize;
| - move occurs because `x` has type `&mut isize`, which does not implement the `Copy` trait
LL | unsafe {
LL | asm!("nop" : : "r"(x));
| - value moved here
LL | }
LL | let z = x; //[ast]~ ERROR use of moved value: `x`
| ^ value used here after move
|
= note: move occurs because `x` has type `&mut isize`, which does not implement the `Copy` trait

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

error: aborting due to 7 previous errors

Expand Down
13 changes: 13 additions & 0 deletions src/test/ui/borrowck/borrowck-consume-unsize-vec.nll.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
error[E0382]: use of moved value: `b`
--> $DIR/borrowck-consume-unsize-vec.rs:8:13
|
LL | fn foo(b: Box<[i32;5]>) {
| - move occurs because `b` has type `std::boxed::Box<[i32; 5]>`, which does not implement the `Copy` trait
LL | consume(b);
| - value moved here
LL | consume(b); //~ ERROR use of moved value
| ^ value used here after move

error: aborting due to previous error

For more information about this error, try `rustc --explain E0382`.
4 changes: 2 additions & 2 deletions src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
error[E0382]: use of moved value: `b`
--> $DIR/borrowck-consume-upcast-box.rs:10:13
|
LL | fn foo(b: Box<Foo+Send>) {
| - move occurs because `b` has type `std::boxed::Box<dyn Foo + std::marker::Send>`, which does not implement the `Copy` trait
LL | consume(b);
| - value moved here
LL | consume(b); //~ ERROR use of moved value
| ^ value used here after move
|
= note: move occurs because `b` has type `std::boxed::Box<dyn Foo + std::marker::Send>`, which does not implement the `Copy` trait

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
error[E0382]: borrow of moved value: `x`
--> $DIR/borrowck-loan-in-overloaded-op.rs:21:20
|
LL | let x = Foo(box 3);
| - move occurs because `x` has type `Foo`, which does not implement the `Copy` trait
LL | let _y = {x} + x.clone(); // the `{x}` forces a move to occur
| - ^ value borrowed here after move
| |
| value moved here
|
= note: move occurs because `x` has type `Foo`, which does not implement the `Copy` trait

error: aborting due to previous error

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
error[E0382]: use of moved value: `t`
--> $DIR/borrowck-move-moved-value-into-closure.rs:14:12
|
LL | let t: Box<_> = box 3;
| - move occurs because `t` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
LL |
LL | call_f(move|| { *t + 1 });
| ------ - variable moved due to use in closure
| |
Expand All @@ -9,8 +12,6 @@ LL | call_f(move|| { *t + 1 }); //[ast]~ ERROR capture of moved value
| ^^^^^^ - use occurs due to use in closure
| |
| value used here after move
|
= note: move occurs because `t` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait

error: aborting due to previous error

Expand Down
Loading

0 comments on commit baa0828

Please sign in to comment.