--- /dev/null
+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`.
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
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
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
--- /dev/null
+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`.
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
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
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
| |
| ^^^^^^ - 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
error[E0382]: use of moved value: `x1`
--> $DIR/borrowck-multiple-captures.rs:25:19
|
+LL | let x1: Box<_> = box 1;
+ | -- move occurs because `x1` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
LL | drop(x1);
| -- value moved here
...
| ^^^^^^ value used here after move
LL | drop(x1); //~ ERROR capture of moved value: `x1`
| -- use occurs due to use in closure
- |
- = note: move occurs because `x1` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `x2`
--> $DIR/borrowck-multiple-captures.rs:25:19
|
+LL | let x2: Box<_> = box 2;
+ | -- move occurs because `x2` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
LL | drop(x2);
| -- value moved here
LL | thread::spawn(move|| {
LL | drop(x1); //~ ERROR capture of moved value: `x1`
LL | drop(x2); //~ ERROR capture of moved value: `x2`
| -- use occurs due to use in closure
- |
- = note: move occurs because `x2` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `x`
--> $DIR/borrowck-multiple-captures.rs:36:14
error[E0382]: use of moved value: `x`
--> $DIR/borrowck-multiple-captures.rs:44:19
|
+LL | let x: Box<_> = box 1;
+ | - move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
LL | drop(x);
| - value moved here
LL | thread::spawn(move|| {
| ^^^^^^ value used here after move
LL | drop(x); //~ ERROR capture of moved value: `x`
| - use occurs due to use in closure
- |
- = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
error: aborting due to 8 previous errors
error[E0382]: use of moved value: `s`
--> $DIR/borrowck-overloaded-call.rs:75:5
|
+LL | let s = SFnOnce {
+ | - move occurs because `s` has type `SFnOnce`, which does not implement the `Copy` trait
+...
LL | s(" world".to_string());
| - value moved here
LL | s(" world".to_string()); //~ ERROR use of moved value: `s`
| ^ value used here after move
- |
- = note: move occurs because `s` has type `SFnOnce`, which does not implement the `Copy` trait
error: aborting due to 3 previous errors
error[E0382]: use of moved value: `s`
--> $DIR/borrowck-overloaded-index-move-index.rs:53:7
|
+LL | let mut s = "hello".to_string();
+ | ----- move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
+...
LL | println!("{}", f[s]);
| - value moved here
...
LL | f[s] = 10;
| ^ value used here after move
- |
- = note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
error: aborting due to 3 previous errors
error[E0382]: assign of moved value: `t`
--> $DIR/borrowck-partial-reinit-1.rs:27:5
|
+LL | let mut t = Test2 { b: None };
+ | ----- move occurs because `t` has type `Test2`, which does not implement the `Copy` trait
+LL | let u = Test;
LL | drop(t);
| - value moved here
LL | t.b = Some(u);
| ^^^ value assigned here after move
- |
- = note: move occurs because `t` has type `Test2`, which does not implement the `Copy` trait
error[E0382]: assign of moved value: `t`
--> $DIR/borrowck-partial-reinit-1.rs:33:5
|
+LL | let mut t = Test3(None);
+ | ----- move occurs because `t` has type `Test3`, which does not implement the `Copy` trait
+LL | let u = Test;
LL | drop(t);
| - value moved here
LL | t.0 = Some(u);
| ^^^ value assigned here after move
- |
- = note: move occurs because `t` has type `Test3`, which does not implement the `Copy` trait
error: aborting due to 2 previous errors
error[E0382]: assign of moved value: `t`
--> $DIR/borrowck-partial-reinit-2.rs:15:5
|
+LL | let mut t = Test { a: 1, b: None};
+ | ----- move occurs because `t` has type `Test`, which does not implement the `Copy` trait
LL | let mut u = Test { a: 2, b: Some(Box::new(t))};
| - value moved here
LL | t.b = Some(Box::new(u));
| ^^^ value assigned here after move
- |
- = note: move occurs because `t` has type `Test`, which does not implement the `Copy` trait
error: aborting due to previous error
error[E0382]: use of moved value: `f`
--> $DIR/borrowck-unboxed-closures.rs:12:5
|
+LL | fn c<F:FnOnce(isize, isize) -> isize>(f: F) {
+ | - - move occurs because `f` has type `F`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | f(1, 2);
| - value moved here
LL | f(1, 2); //~ ERROR use of moved value
| ^ value used here after move
- |
- = note: move occurs because `f` has type `F`, which does not implement the `Copy` trait
error: aborting due to 3 previous errors
error[E0382]: use of moved value: `u`
--> $DIR/borrowck-union-move-assign.rs:17:21
|
+LL | let mut u = U { a: A };
+ | ----- move occurs because `u` has type `U`, which does not implement the `Copy` trait
LL | let a = u.a;
| --- value moved here
LL | let a = u.a; //~ ERROR use of moved value: `u.a`
| ^^^ value used here after move
- |
- = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait
error: aborting due to previous error
error[E0382]: use of moved value: `u`
--> $DIR/borrowck-union-move.rs:26:21
|
+LL | let mut u = Unn { n1: NonCopy };
+ | ----- move occurs because `u` has type `Unn`, which does not implement the `Copy` trait
LL | let a = u.n1;
| ---- value moved here
LL | let a = u.n1; //~ ERROR use of moved value: `u.n1`
| ^^^^ value used here after move
- |
- = note: move occurs because `u` has type `Unn`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `u`
--> $DIR/borrowck-union-move.rs:31:21
|
+LL | let mut u = Unn { n1: NonCopy };
+ | ----- move occurs because `u` has type `Unn`, which does not implement the `Copy` trait
LL | let a = u.n1;
| ---- value moved here
LL | let a = u; //~ ERROR use of partially moved value: `u`
| ^ value used here after move
- |
- = note: move occurs because `u` has type `Unn`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `u`
--> $DIR/borrowck-union-move.rs:36:21
|
+LL | let mut u = Unn { n1: NonCopy };
+ | ----- move occurs because `u` has type `Unn`, which does not implement the `Copy` trait
LL | let a = u.n1;
| ---- value moved here
LL | let a = u.n2; //~ ERROR use of moved value: `u.n2`
| ^^^^ value used here after move
- |
- = note: move occurs because `u` has type `Unn`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `u`
--> $DIR/borrowck-union-move.rs:63:21
|
+LL | let mut u = Ucn { c: Copy };
+ | ----- move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait
LL | let a = u.n;
| --- value moved here
LL | let a = u.n; //~ ERROR use of moved value: `u.n`
| ^^^ value used here after move
- |
- = note: move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `u`
--> $DIR/borrowck-union-move.rs:68:21
|
+LL | let mut u = Ucn { c: Copy };
+ | ----- move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait
LL | let a = u.n;
| --- value moved here
LL | let a = u.c; //~ ERROR use of moved value: `u.c`
| ^^^ value used here after move
- |
- = note: move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `u`
--> $DIR/borrowck-union-move.rs:83:21
|
+LL | let mut u = Ucn { c: Copy };
+ | ----- move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait
LL | let a = u.n;
| --- value moved here
LL | let a = u; //~ ERROR use of partially moved value: `u`
| ^ value used here after move
- |
- = note: move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait
error: aborting due to 6 previous errors
error[E0382]: use of moved value: `*f`
--> $DIR/two-phase-nonrecv-autoref.rs:69:11
|
+LL | fn twice_ten_so<F: FnOnce(i32) -> i32>(f: Box<F>) {
+ | - consider adding a `Copy` constraint to this type argument
LL | f(f(10));
| - ^ value used here after move
| |
error[E0382]: borrow of moved value: `some_vec`
--> $DIR/tab_3.rs:7:20
|
+LL | let some_vec = vec!["hi"];
+ | -------- move occurs because `some_vec` has type `std::vec::Vec<&str>`, which does not implement the `Copy` trait
LL | some_vec.into_iter();
| -------- value moved here
LL | {
LL | println!("{:?}", some_vec); //~ ERROR use of moved
| ^^^^^^^^ value borrowed here after move
- |
- = note: move occurs because `some_vec` has type `std::vec::Vec<&str>`, which does not implement the `Copy` trait
error: aborting due to previous error
error[E0382]: use of moved value: `foo`
--> $DIR/issue-17385.rs:19:11
|
+LL | let foo = X(1);
+ | --- move occurs because `foo` has type `X`, which does not implement the `Copy` trait
LL | drop(foo);
| --- value moved here
LL | match foo { //~ ERROR use of moved value
LL | X(1) => (),
| ^ value used here after move
- |
- = note: move occurs because `foo` has type `X`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `e`
--> $DIR/issue-17385.rs:25:11
|
+LL | let e = Enum::Variant2;
+ | - move occurs because `e` has type `Enum`, which does not implement the `Copy` trait
LL | drop(e);
| - value moved here
LL | match e { //~ ERROR use of moved value
| ^ value used here after move
- |
- = note: move occurs because `e` has type `Enum`, which does not implement the `Copy` trait
error: aborting due to 2 previous errors
error[E0382]: use of moved value: `x`
--> $DIR/issue-24357.rs:6:12
|
+LL | let x = NoCopy;
+ | - move occurs because `x` has type `NoCopy`, which does not implement the `Copy` trait
LL | let f = move || { let y = x; };
| ------- - variable moved due to use in closure
| |
LL | //~^ NOTE value moved (into closure) here
LL | let z = x;
| ^ value used here after move
- |
- = note: move occurs because `x` has type `NoCopy`, which does not implement the `Copy` trait
error: aborting due to previous error
--- /dev/null
+error[E0382]: use of moved value: `t`
+ --> $DIR/issue-25700.rs:13:10
+ |
+LL | let t = S::<()>(None);
+ | - move occurs because `t` has type `S<()>`, which does not implement the `Copy` trait
+LL | drop(t);
+ | - value moved here
+LL | drop(t); //~ 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`.
error[E0382]: borrow of moved value: `s`
--> $DIR/issue-42796.rs:18:20
|
+LL | let s = "Hello!".to_owned();
+ | - move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
LL | let mut s_copy = s;
| - value moved here
...
LL | println!("{}", s); //~ ERROR use of moved value
| ^ value borrowed here after move
- |
- = note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
error: aborting due to previous error
error[E0382]: use of moved value: `x`
--> $DIR/liveness-move-call-arg.rs:9:14
|
+LL | let x: Box<isize> = box 25;
+ | - move occurs because `x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+LL | loop {
LL | take(x); //~ ERROR use of moved value: `x`
| ^ value moved here, in previous iteration of loop
- |
- = note: move occurs because `x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
error: aborting due to previous error
error[E0382]: use of moved value: `y`
--> $DIR/liveness-move-in-loop.rs:11:25
|
+LL | let y: Box<isize> = box 42;
+ | - move occurs because `y` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+...
LL | x = y; //~ ERROR use of moved value
| ^ value moved here, in previous iteration of loop
- |
- = note: move occurs because `y` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
error: aborting due to previous error
error[E0382]: borrow of moved value: `y`
--> $DIR/liveness-move-in-while.rs:7:24
|
+LL | let y: Box<isize> = box 42;
+ | - move occurs because `y` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+...
LL | println!("{}", y); //~ ERROR use of moved value: `y`
| ^ value borrowed here after move
LL | while true { while true { while true { x = y; x.clone(); } } }
| - value moved here, in previous iteration of loop
- |
- = note: move occurs because `y` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
error: aborting due to previous error
error[E0382]: borrow of moved value: `x`
--> $DIR/liveness-use-after-move.rs:6:20
|
+LL | let x: Box<_> = box 5;
+ | - move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
LL | let y = x;
| - value moved here
LL | println!("{}", *x); //~ ERROR use of moved value: `*x`
| ^^ value borrowed here after move
- |
- = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
error: aborting due to previous error
error[E0382]: borrow of moved value: `message`
--> $DIR/liveness-use-after-send.rs:16:20
|
+LL | fn test00_start(ch: Chan<Box<isize>>, message: Box<isize>, _count: Box<isize>) {
+ | ------- move occurs because `message` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
LL | send(ch, message);
| ------- value moved here
LL | println!("{}", message); //~ ERROR use of moved value: `message`
| ^^^^^^^ value borrowed here after move
- |
- = note: move occurs because `message` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
error: aborting due to previous error
--- /dev/null
+error[E0382]: use of moved value: `x`
+ --> $DIR/move-guard-same-consts.rs:20:24
+ |
+LL | let x: Box<_> = box 1;
+ | - move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+...
+LL | (1, 2) if take(x) => (),
+ | - value moved here
+LL | (1, 2) if take(x) => (), //~ ERROR use of moved value: `x`
+ | ^ value used here after move
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
--- /dev/null
+error[E0382]: use of moved value: `x`
+ --> $DIR/move-in-guard-1.rs:10:24
+ |
+LL | let x: Box<_> = box 1;
+ | - move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+...
+LL | (1, _) if take(x) => (),
+ | - value moved here
+LL | (_, 2) if take(x) => (), //~ ERROR use of moved value: `x`
+ | ^ value used here after move
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
error[E0382]: use of moved value: `x`
--> $DIR/move-in-guard-2.rs:10:24
|
+LL | let x: Box<_> = box 1;
+ | - move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+...
LL | (_, 2) if take(x) => (), //~ ERROR use of moved value: `x`
| ^ value moved here, in previous iteration of loop
- |
- = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
error: aborting due to previous error
error[E0382]: use of moved value: `a`
--> $DIR/move-into-dead-array-2.rs:14:5
|
+LL | fn foo(mut a: [D; 4], i: usize) {
+ | ----- move occurs because `a` has type `[D; 4]`, which does not implement the `Copy` trait
LL | drop(a);
| - value moved here
LL | a[i] = d(); //~ ERROR use of moved value: `a`
| ^^^^ value used here after move
- |
- = note: move occurs because `a` has type `[D; 4]`, which does not implement the `Copy` trait
error: aborting due to previous error
error[E0382]: borrow of moved value: `x`
--> $DIR/moves-based-on-type-access-to-field.rs:11:12
|
+LL | let x = vec!["hi".to_string()];
+ | - move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
LL | consume(x.into_iter().next().unwrap());
| - value moved here
LL | touch(&x[0]); //~ ERROR use of moved value: `x`
| ^ value borrowed here after move
- |
- = note: move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
error: aborting due to previous error
error[E0382]: borrow of moved value: `x`
--> $DIR/moves-based-on-type-capture-clause-bad.rs:8:20
|
+LL | let x = "Hello world!".to_string();
+ | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
LL | thread::spawn(move|| {
| ------ value moved into closure here
LL | println!("{}", x);
LL | });
LL | println!("{}", x); //~ ERROR use of moved value
| ^ value borrowed here after move
- |
- = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
error: aborting due to previous error
error[E0382]: borrow of moved value: `x`
--> $DIR/moves-based-on-type-distribute-copy-over-paren.rs:11:11
|
+LL | let x = "hi".to_string();
+ | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
LL | let _y = Foo { f:x };
| - value moved here
LL | //~^ NOTE value moved here
LL | touch(&x); //~ ERROR use of moved value: `x`
| ^^ value borrowed here after move
- |
- = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
error[E0382]: borrow of moved value: `x`
--> $DIR/moves-based-on-type-distribute-copy-over-paren.rs:20:11
|
+LL | let x = "hi".to_string();
+ | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
LL | let _y = Foo { f:(((x))) };
| ------- value moved here
LL | //~^ NOTE value moved here
LL | touch(&x); //~ ERROR use of moved value: `x`
| ^^ value borrowed here after move
- |
- = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
error: aborting due to 2 previous errors
error[E0382]: borrow of moved value: `x`
--> $DIR/moves-based-on-type-exprs.rs:12:11
|
+LL | let x = "hi".to_string();
+ | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
LL | let _y = Foo { f:x };
| - value moved here
LL | touch(&x); //~ ERROR use of moved value: `x`
| ^^ value borrowed here after move
- |
- = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
error[E0382]: borrow of moved value: `x`
--> $DIR/moves-based-on-type-exprs.rs:18:11
|
+LL | let x = "hi".to_string();
+ | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
LL | let _y = (x, 3);
| - value moved here
LL | touch(&x); //~ ERROR use of moved value: `x`
| ^^ value borrowed here after move
- |
- = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
error[E0382]: borrow of moved value: `x`
--> $DIR/moves-based-on-type-exprs.rs:35:11
|
+LL | let x = "hi".to_string();
+ | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+...
LL | x
| - value moved here
...
LL | touch(&x); //~ ERROR use of moved value: `x`
| ^^ value borrowed here after move
- |
- = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
error[E0382]: borrow of moved value: `y`
--> $DIR/moves-based-on-type-exprs.rs:36:11
|
+LL | let y = "ho".to_string();
+ | - move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait
+...
LL | y
| - value moved here
...
LL | touch(&y); //~ ERROR use of moved value: `y`
| ^^ value borrowed here after move
- |
- = note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait
error[E0382]: borrow of moved value: `x`
--> $DIR/moves-based-on-type-exprs.rs:46:11
|
+LL | let x = "hi".to_string();
+ | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+...
LL | true => x,
| - value moved here
...
LL | touch(&x); //~ ERROR use of moved value: `x`
| ^^ value borrowed here after move
- |
- = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
error[E0382]: borrow of moved value: `y`
--> $DIR/moves-based-on-type-exprs.rs:47:11
|
+LL | let y = "ho".to_string();
+ | - move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait
+...
LL | false => y
| - value moved here
...
LL | touch(&y); //~ ERROR use of moved value: `y`
| ^^ value borrowed here after move
- |
- = note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait
error[E0382]: borrow of moved value: `x`
--> $DIR/moves-based-on-type-exprs.rs:58:11
|
+LL | let x = "hi".to_string();
+ | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+...
LL | _ if guard(x) => 10,
| - value moved here
...
LL | touch(&x); //~ ERROR use of moved value: `x`
| ^^ value borrowed here after move
- |
- = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
error[E0382]: borrow of moved value: `x`
--> $DIR/moves-based-on-type-exprs.rs:65:11
|
+LL | let x = "hi".to_string();
+ | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
LL | let _y = [x];
| - value moved here
LL | touch(&x); //~ ERROR use of moved value: `x`
| ^^ value borrowed here after move
- |
- = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
error[E0382]: borrow of moved value: `x`
--> $DIR/moves-based-on-type-exprs.rs:71:11
|
+LL | let x = "hi".to_string();
+ | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
LL | let _y = vec![x];
| - value moved here
LL | touch(&x); //~ ERROR use of moved value: `x`
| ^^ value borrowed here after move
- |
- = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
error[E0382]: borrow of moved value: `x`
--> $DIR/moves-based-on-type-exprs.rs:77:11
|
+LL | let x = vec!["hi".to_string()];
+ | - move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
LL | let _y = x.into_iter().next().unwrap();
| - value moved here
LL | touch(&x); //~ ERROR use of moved value: `x`
| ^^ value borrowed here after move
- |
- = note: move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
error[E0382]: borrow of moved value: `x`
--> $DIR/moves-based-on-type-exprs.rs:83:11
|
+LL | let x = vec!["hi".to_string()];
+ | - move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
LL | let _y = [x.into_iter().next().unwrap(); 1];
| - value moved here
LL | touch(&x); //~ ERROR use of moved value: `x`
| ^^ value borrowed here after move
- |
- = note: move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
error: aborting due to 11 previous errors
error[E0382]: borrow of moved value: `f`
--> $DIR/moves-based-on-type-no-recursive-stack-closure.rs:32:5
|
+LL | fn conspirator<F>(mut f: F) where F: FnMut(&mut R, bool) {
+ | - ----- move occurs because `f` has type `F`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
LL | let mut r = R {c: Box::new(f)};
| - value moved here
LL | f(&mut r, false) //~ ERROR use of moved value
| ^ value borrowed here after move
- |
- = note: move occurs because `f` has type `F`, which does not implement the `Copy` trait
error: aborting due to 2 previous errors
error[E0382]: borrow of moved value: `arc_v`
--> $DIR/no-capture-arc.rs:14:18
|
+LL | let arc_v = Arc::new(v);
+ | ----- move occurs because `arc_v` has type `std::sync::Arc<std::vec::Vec<i32>>`, which does not implement the `Copy` trait
+LL |
LL | thread::spawn(move|| {
| ------ value moved into closure here
LL | assert_eq!((*arc_v)[3], 4);
...
LL | assert_eq!((*arc_v)[2], 3);
| ^^^^^ value borrowed here after move
- |
- = note: move occurs because `arc_v` has type `std::sync::Arc<std::vec::Vec<i32>>`, which does not implement the `Copy` trait
error: aborting due to previous error
error[E0382]: borrow of moved value: `arc_v`
--> $DIR/no-reuse-move-arc.rs:12:18
|
+LL | let arc_v = Arc::new(v);
+ | ----- move occurs because `arc_v` has type `std::sync::Arc<std::vec::Vec<i32>>`, which does not implement the `Copy` trait
+LL |
LL | thread::spawn(move|| {
| ------ value moved into closure here
LL | assert_eq!((*arc_v)[3], 4);
...
LL | assert_eq!((*arc_v)[2], 3); //~ ERROR use of moved value: `arc_v`
| ^^^^^ value borrowed here after move
- |
- = note: move occurs because `arc_v` has type `std::sync::Arc<std::vec::Vec<i32>>`, which does not implement the `Copy` trait
error: aborting due to previous error
--- /dev/null
+error[E0382]: use of moved value: `blk`
+ --> $DIR/once-cant-call-twice-on-heap.rs:9:5
+ |
+LL | fn foo<F:FnOnce()>(blk: F) {
+ | - --- move occurs because `blk` has type `F`, which does not implement the `Copy` trait
+ | |
+ | consider adding a `Copy` constraint to this type argument
+LL | blk();
+ | --- value moved here
+LL | blk(); //~ 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`.
error[E0382]: use of moved value: `x`
--> $DIR/ref-suggestion.rs:4:5
|
+LL | let x = vec![1];
+ | - move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
LL | let y = x;
| - value moved here
LL | x; //~ ERROR use of moved value
| ^ value used here after move
- |
- = note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `x`
--> $DIR/ref-suggestion.rs:8:5
|
+LL | let x = vec![1];
+ | - move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
LL | let mut y = x;
| - value moved here
LL | x; //~ ERROR use of moved value
| ^ value used here after move
- |
- = note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `x`
--> $DIR/ref-suggestion.rs:16:5
error[E0382]: use of moved value: `a`
--> $DIR/dbg-macro-move-semantics.rs:9:18
|
+LL | let a = NoCopy(0);
+ | - move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait
LL | let _ = dbg!(a);
| ------- value moved here
LL | let _ = dbg!(a); //~ ERROR use of moved value
| ^ value used here after move
|
- = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: aborting due to previous error
error[E0382]: use of moved value: `u`
--> $DIR/union-borrow-move-parent-sibling.rs:22:13
|
+LL | let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
+ | - move occurs because `u` has type `U`, which does not implement the `Copy` trait
LL | let a = u.x.0;
| ----- value moved here
LL | let b = u.y; //~ ERROR use of moved value: `u.y`
| ^^^ value used here after move
- |
- = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait
error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x.0.0`)
--> $DIR/union-borrow-move-parent-sibling.rs:28:13
error[E0382]: use of moved value: `u`
--> $DIR/union-borrow-move-parent-sibling.rs:35:13
|
+LL | let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
+ | - move occurs because `u` has type `U`, which does not implement the `Copy` trait
LL | let a = (u.x.0).0;
| --------- value moved here
LL | let b = u.y; //~ ERROR use of moved value: `u.y`
| ^^^ value used here after move
- |
- = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait
error[E0502]: cannot borrow `u` (via `u.x`) as immutable because it is also borrowed as mutable (via `*u.y`)
--> $DIR/union-borrow-move-parent-sibling.rs:41:13
error[E0382]: use of moved value: `u`
--> $DIR/union-borrow-move-parent-sibling.rs:48:13
|
+LL | let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) };
+ | - move occurs because `u` has type `U`, which does not implement the `Copy` trait
LL | let a = *u.y;
| ---- value moved here
LL | let b = u.x; //~ ERROR use of moved value: `u.x`
| ^^^ value used here after move
- |
- = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait
error: aborting due to 6 previous errors
error[E0382]: borrow of moved value: `x`
--> $DIR/unop-move-semantics.rs:8:5
|
+LL | fn move_then_borrow<T: Not<Output=T> + 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/unop-move-semantics.rs:15:6
error[E0382]: borrow of moved value: `y`
--> $DIR/borrow-after-move.rs:22:24
|
+LL | let y = *x;
+ | - move occurs because `y` has type `str`, which does not implement the `Copy` trait
LL | drop_unsized(y);
| - value moved here
...
LL | println!("{}", &y);
| ^^ value borrowed here after move
- |
- = note: move occurs because `y` has type `str`, which does not implement the `Copy` trait
error[E0382]: borrow of moved value: `x`
--> $DIR/borrow-after-move.rs:30:24
error[E0382]: borrow of moved value: `y`
--> $DIR/borrow-after-move.rs:32:24
|
+LL | let y = *x;
+ | - move occurs because `y` has type `str`, which does not implement the `Copy` trait
LL | y.foo();
| - value moved here
...
LL | println!("{}", &y);
| ^^ value borrowed here after move
- |
- = note: move occurs because `y` has type `str`, which does not implement the `Copy` trait
error[E0382]: borrow of moved value: `x`
--> $DIR/borrow-after-move.rs:39:24
error[E0382]: use of moved value: `y`
--> $DIR/double-move.rs:20:22
|
+LL | let y = *x;
+ | - move occurs because `y` has type `str`, which does not implement the `Copy` trait
LL | drop_unsized(y);
| - value moved here
LL | drop_unsized(y); //~ERROR use of moved value
| ^ value used here after move
- |
- = note: move occurs because `y` has type `str`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `x`
--> $DIR/double-move.rs:26:22
error[E0382]: use of moved value: `*x`
--> $DIR/double-move.rs:32:18
|
+LL | let x = "hello".to_owned().into_boxed_str();
+ | - move occurs because `x` has type `std::boxed::Box<str>`, which does not implement the `Copy` trait
LL | drop_unsized(x);
| - value moved here
LL | let _y = *x; //~ERROR use of moved value
| ^^ value used here after move
- |
- = note: move occurs because `x` has type `std::boxed::Box<str>`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `y`
--> $DIR/double-move.rs:39:9
|
+LL | let y = *x;
+ | - move occurs because `y` has type `str`, which does not implement the `Copy` trait
LL | y.foo();
| - value moved here
LL | y.foo(); //~ERROR use of moved value
| ^ value used here after move
- |
- = note: move occurs because `y` has type `str`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `*x`
--> $DIR/double-move.rs:45:9
error[E0382]: borrow of moved value: `x`
--> $DIR/use-after-move-based-on-type.rs:4:20
|
+LL | let x = "Hello!".to_string();
+ | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
LL | let _y = x;
| - value moved here
LL | println!("{}", x); //~ ERROR use of moved value
| ^ value borrowed here after move
- |
- = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
error: aborting due to previous error
error[E0382]: borrow of moved value: `n`
--> $DIR/use-after-move-implicity-coerced-object.rs:28:13
|
+LL | let n: Box<_> = box Number { n: 42 };
+ | - move occurs because `n` has type `std::boxed::Box<Number>`, which does not implement the `Copy` trait
+LL | let mut l: Box<_> = box List { list: Vec::new() };
LL | l.push(n);
| - value moved here
LL | let x = n.to_string();
| ^ value borrowed here after move
- |
- = note: move occurs because `n` has type `std::boxed::Box<Number>`, which does not implement the `Copy` trait
error: aborting due to previous error
error[E0382]: use of moved value: `self`
--> $DIR/use-after-move-self-based-on-type.rs:12:16
|
+LL | pub fn foo(self) -> isize {
+ | ---- move occurs because `self` has type `S`, which does not implement the `Copy` trait
LL | self.bar();
| ---- value moved here
LL | return self.x; //~ ERROR use of moved value: `self.x`
| ^^^^^^ value used here after move
- |
- = note: move occurs because `self` has type `S`, which does not implement the `Copy` trait
error: aborting due to previous error
error[E0382]: use of moved value: `self`
--> $DIR/use-after-move-self.rs:10:16
|
+LL | pub fn foo(self) -> isize {
+ | ---- move occurs because `self` has type `S`, which does not implement the `Copy` trait
LL | self.bar();
| ---- value moved here
LL | return *self.x; //~ ERROR use of moved value: `*self.x`
| ^^^^^^^ value used here after move
- |
- = note: move occurs because `self` has type `S`, which does not implement the `Copy` trait
error: aborting due to previous error
error[E0382]: borrow of moved value: `start`
--> $DIR/walk-struct-literal-with.rs:16:20
|
+LL | let start = Mine{test:"Foo".to_string(), other_val:0};
+ | ----- move occurs because `start` has type `Mine`, which does not implement the `Copy` trait
LL | let end = Mine{other_val:1, ..start.make_string_bar()};
| ----- value moved here
LL | println!("{}", start.test); //~ ERROR use of moved value: `start.test`
| ^^^^^^^^^^ value borrowed here after move
- |
- = note: move occurs because `start` has type `Mine`, which does not implement the `Copy` trait
error: aborting due to previous error