| ^^^^^^^^
| |
| cannot move out of here
- | help: consider using a reference instead: `&array[0]`
+ | help: consider borrowing here: `&array[0]`
error: aborting due to previous error
--> $DIR/access-mode-in-closures.rs:19:15
|
LL | match *s { sty(v) => v } //~ ERROR cannot move out
- | ^^ - move occurs because v has type `std::vec::Vec<isize>`, which does not implement the `Copy` trait
+ | ^^ - data moved here
| |
| cannot move out of borrowed content
- | help: consider removing this dereference operator: `s`
+ | help: consider removing the `*`: `s`
+ |
+note: move occurs because `v` has type `std::vec::Vec<isize>`, which does not implement the `Copy` trait
+ --> $DIR/access-mode-in-closures.rs:19:24
+ |
+LL | match *s { sty(v) => v } //~ ERROR cannot move out
+ | ^
error: aborting due to previous error
--> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:15
|
LL | for &a in x.iter() { //~ ERROR cannot move out
- | - ^^^^^^^^ cannot move out of borrowed content
- | |
- | data moved here
- | help: to prevent move, use ref or ref mut: `ref a`
+ | -- ^^^^^^^^ cannot move out of borrowed content
+ | ||
+ | |data moved here
+ | help: consider removing the `&`: `a`
+ |
+note: move occurs because `a` has type `&mut i32`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:10
+ |
+LL | for &a in x.iter() { //~ ERROR cannot move out
+ | ^
error[E0507]: cannot move out of borrowed content
--> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:28:15
|
LL | for &a in &f.a { //~ ERROR cannot move out
- | - ^^^^ cannot move out of borrowed content
- | |
- | data moved here
- | help: to prevent move, use ref or ref mut: `ref a`
+ | -- ^^^^ cannot move out of borrowed content
+ | ||
+ | |data moved here
+ | help: consider removing the `&`: `a`
+ |
+note: move occurs because `a` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:28:10
+ |
+LL | for &a in &f.a { //~ ERROR cannot move out
+ | ^
error[E0507]: cannot move out of borrowed content
--> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:32:15
|
LL | for &a in x.iter() { //~ ERROR cannot move out
- | - ^^^^^^^^ cannot move out of borrowed content
- | |
- | data moved here
- | help: to prevent move, use ref or ref mut: `ref a`
+ | -- ^^^^^^^^ cannot move out of borrowed content
+ | ||
+ | |data moved here
+ | help: consider removing the `&`: `a`
+ |
+note: move occurs because `a` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:32:10
+ |
+LL | for &a in x.iter() { //~ ERROR cannot move out
+ | ^
error: aborting due to 3 previous errors
| ^^
| |
| cannot move out of borrowed content
- | help: consider removing this dereference operator: `y`
+ | help: consider removing the `*`: `y`
error: aborting due to previous error
| ^^
| |
| cannot move out of borrowed content
- | help: consider using a reference instead: `&*x`
+ | help: consider removing the `*`: `x`
error: aborting due to previous error
| ^--
| ||
| |data moved here
- | |help: to prevent move, use ref or ref mut: `ref _x`
| cannot move out of borrowed content
+ | help: consider removing the `&`: `_x`
+ |
+note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:16:14
+ |
+LL | fn arg_item(&_x: &String) {}
+ | ^^
error[E0507]: cannot move out of borrowed content
--> $DIR/borrowck-move-in-irrefut-pat.rs:21:11
| ^--
| ||
| |data moved here
- | |help: to prevent move, use ref or ref mut: `ref _x`
| cannot move out of borrowed content
+ | help: consider removing the `&`: `_x`
+ |
+note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:21:12
+ |
+LL | with(|&_x| ())
+ | ^^
error[E0507]: cannot move out of borrowed content
--> $DIR/borrowck-move-in-irrefut-pat.rs:27:15
|
LL | let &_x = &"hi".to_string();
- | -- ^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
- | |
- | data moved here
- | help: to prevent move, use ref or ref mut: `ref _x`
+ | --- ^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+ | ||
+ | |data moved here
+ | help: consider removing the `&`: `_x`
+ |
+note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:27:10
+ |
+LL | let &_x = &"hi".to_string();
+ | ^^
error: aborting due to 3 previous errors
| ^--
| ||
| |data moved here
- | |help: to prevent move, use ref or ref mut: `ref _x`
| cannot move out of borrowed content
+ | help: consider removing the `&`: `_x`
+ |
+note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:16:14
+ |
+LL | fn arg_item(&_x: &String) {}
+ | ^^
error[E0507]: cannot move out of borrowed content
--> $DIR/borrowck-move-in-irrefut-pat.rs:21:11
| ^--
| ||
| |data moved here
- | |help: to prevent move, use ref or ref mut: `ref _x`
| cannot move out of borrowed content
+ | help: consider removing the `&`: `_x`
+ |
+note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:21:12
+ |
+LL | with(|&_x| ())
+ | ^^
error[E0507]: cannot move out of borrowed content
--> $DIR/borrowck-move-in-irrefut-pat.rs:27:15
|
LL | let &_x = &"hi".to_string();
- | -- ^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
- | |
- | data moved here
- | help: to prevent move, use ref or ref mut: `ref _x`
+ | --- ^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+ | ||
+ | |data moved here
+ | help: consider removing the `&`: `_x`
+ |
+note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:27:10
+ |
+LL | let &_x = &"hi".to_string();
+ | ^^
error: aborting due to 3 previous errors
| ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
LL | //[mir]~^ ERROR [E0509]
LL | S {f:_s} => {}
- | --
- | |
- | data moved here
- | help: to prevent move, use ref or ref mut: `ref _s`
+ | -- data moved here
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:22:14
+ |
+LL | S {f:_s} => {}
+ | ^^
error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
--> $DIR/borrowck-move-out-of-struct-with-dtor.rs:28:20
| -- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
| |
| data moved here
- | help: to prevent move, use ref or ref mut: `ref _s`
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:28:14
+ |
+LL | let S {f:_s} = S {f:"foo".to_string()};
+ | ^^
error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
--> $DIR/borrowck-move-out-of-struct-with-dtor.rs:33:19
| ^^^^^--^
| | |
| | data moved here
- | | help: to prevent move, use ref or ref mut: `ref _s`
| cannot move out of here
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:33:24
+ |
+LL | fn move_in_fn_arg(S {f:_s}: S) {
+ | ^^
error: aborting due to 3 previous errors
| ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
LL | //[mir]~^ ERROR [E0509]
LL | S {f:_s} => {}
- | --
- | |
- | data moved here
- | help: to prevent move, use ref or ref mut: `ref _s`
+ | -- data moved here
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:22:14
+ |
+LL | S {f:_s} => {}
+ | ^^
error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
--> $DIR/borrowck-move-out-of-struct-with-dtor.rs:28:20
| -- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
| |
| data moved here
- | help: to prevent move, use ref or ref mut: `ref _s`
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:28:14
+ |
+LL | let S {f:_s} = S {f:"foo".to_string()};
+ | ^^
error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
--> $DIR/borrowck-move-out-of-struct-with-dtor.rs:33:19
| ^^^^^--^
| | |
| | data moved here
- | | help: to prevent move, use ref or ref mut: `ref _s`
| cannot move out of here
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:33:24
+ |
+LL | fn move_in_fn_arg(S {f:_s}: S) {
+ | ^^
error: aborting due to 3 previous errors
LL | match S("foo".to_string()) {
| ^^^^^^^^^^^^^^^^^^^^ cannot move out of here
LL | S(_s) => {}
- | --
- | |
- | data moved here
- | help: to prevent move, use ref or ref mut: `ref _s`
+ | -- data moved here
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:18:11
+ |
+LL | S(_s) => {}
+ | ^^
error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
--> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:24:17
| -- ^^^^^^^^^^^^^^^^^^^^ cannot move out of here
| |
| data moved here
- | help: to prevent move, use ref or ref mut: `ref _s`
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:24:11
+ |
+LL | let S(_s) = S("foo".to_string());
+ | ^^
error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
--> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:28:19
| ^^--^
| | |
| | data moved here
- | | help: to prevent move, use ref or ref mut: `ref _s`
| cannot move out of here
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:28:21
+ |
+LL | fn move_in_fn_arg(S(_s): S) {
+ | ^^
error: aborting due to 3 previous errors
| ^^^^
| |
| cannot move out of borrowed content
- | help: consider using a reference instead: `&v[0]`
+ | help: consider borrowing here: `&v[0]`
error: aborting due to previous error
| ^^^^ cannot move out of borrowed content
LL | &E::Foo => {}
LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move
- | ----------
- | |
- | data moved here
- | help: to prevent move, use ref or ref mut: `ref identifier`
+ | -------------------
+ | | |
+ | | data moved here
+ | help: consider removing the `&`: `E::Bar(identifier)`
+ |
+note: move occurs because `identifier` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/by-move-pattern-binding.rs:26:17
+ |
+LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move
+ | ^^^^^^^^^^
error: aborting due to previous error
| ^
| |
| cannot move out of static item
- | help: consider using a reference instead: `&x`
+ | help: consider borrowing here: `&x`
error[E0010]: allocations are not allowed in statics
--> $DIR/check-static-values-constraints.rs:120:38
| - ^ cannot move out of here
| |
| data moved here
- | help: to prevent move, use ref or ref mut: `ref y`
+ |
+note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:22:16
+ |
+LL | let X { x: y } = x; //~ ERROR cannot move out of type
+ | ^
error: aborting due to previous error
LL | match x {
| ^ cannot move out of here
LL | X { x: y } => println!("contents: {}", y)
- | -
- | |
- | data moved here
- | help: to prevent move, use ref or ref mut: `ref y`
+ | - data moved here
+ |
+note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/disallowed-deconstructing-destructing-struct-match.rs:25:16
+ |
+LL | X { x: y } => println!("contents: {}", y)
+ | ^
error: aborting due to previous error
LL | match a {
| ^ cannot move out of here
LL | box [a] => {}, //~ ERROR cannot move out of type `[A]`, a non-copy slice
- | -
- | |
- | data moved here
- | help: to prevent move, use ref or ref mut: `ref a`
+ | - data moved here
+ |
+note: move occurs because `a` has type `A`, which does not implement the `Copy` trait
+ --> $DIR/move-out-of-slice-1.rs:18:14
+ |
+LL | box [a] => {}, //~ ERROR cannot move out of type `[A]`, a non-copy slice
+ | ^
error: aborting due to previous error