diff --git a/src/test/ui/E0508-fail.mir.stderr b/src/test/ui/E0508-fail.mir.stderr index faf7411af31..fda6c24dc87 100644 --- a/src/test/ui/E0508-fail.mir.stderr +++ b/src/test/ui/E0508-fail.mir.stderr @@ -5,7 +5,7 @@ LL | let _value = array[0]; //[ast]~ ERROR [E0508] | ^^^^^^^^ | | | 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 diff --git a/src/test/ui/access-mode-in-closures.nll.stderr b/src/test/ui/access-mode-in-closures.nll.stderr index 2aa8f1c3813..b9de60f43f7 100644 --- a/src/test/ui/access-mode-in-closures.nll.stderr +++ b/src/test/ui/access-mode-in-closures.nll.stderr @@ -2,10 +2,16 @@ error[E0507]: cannot move out of borrowed content --> $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`, 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`, 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 diff --git a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr index f9e517def14..25eb69ad937 100644 --- a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr +++ b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr @@ -2,28 +2,46 @@ error[E0507]: cannot move out of borrowed content --> $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`, 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`, 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 diff --git a/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr b/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr index 55c6a40d281..cdbfab8bd05 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr +++ b/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr @@ -5,7 +5,7 @@ LL | let _b = *y; //~ ERROR cannot move out | ^^ | | | cannot move out of borrowed content - | help: consider removing this dereference operator: `y` + | help: consider removing the `*`: `y` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr index 4f692bfc55e..f823a6f08d7 100644 --- a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr @@ -5,7 +5,7 @@ LL | let y = *x; //~ ERROR cannot move out of dereference of raw pointer | ^^ | | | cannot move out of borrowed content - | help: consider using a reference instead: `&*x` + | help: consider removing the `*`: `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr index f670936dbac..49c2ec0dcf4 100644 --- a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr @@ -5,8 +5,14 @@ LL | fn arg_item(&_x: &String) {} | ^-- | || | |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 @@ -15,17 +21,29 @@ LL | with(|&_x| ()) | ^-- | || | |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 diff --git a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.mir.stderr b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.mir.stderr index f670936dbac..49c2ec0dcf4 100644 --- a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.mir.stderr +++ b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.mir.stderr @@ -5,8 +5,14 @@ LL | fn arg_item(&_x: &String) {} | ^-- | || | |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 @@ -15,17 +21,29 @@ LL | with(|&_x| ()) | ^-- | || | |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 diff --git a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.nll.stderr index 15c7011d716..34f9f035188 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.nll.stderr @@ -5,10 +5,13 @@ LL | match (S {f:"foo".to_string()}) { | ^^^^^^^^^^^^^^^^^^^^^^^^^ 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 @@ -17,7 +20,12 @@ LL | let S {f:_s} = S {f:"foo".to_string()}; | -- ^^^^^^^^^^^^^^^^^^^^^^^ 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 @@ -26,8 +34,13 @@ LL | fn move_in_fn_arg(S {f:_s}: S) { | ^^^^^--^ | | | | | 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 diff --git a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.mir.stderr b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.mir.stderr index 15c7011d716..34f9f035188 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.mir.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.mir.stderr @@ -5,10 +5,13 @@ LL | match (S {f:"foo".to_string()}) { | ^^^^^^^^^^^^^^^^^^^^^^^^^ 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 @@ -17,7 +20,12 @@ LL | let S {f:_s} = S {f:"foo".to_string()}; | -- ^^^^^^^^^^^^^^^^^^^^^^^ 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 @@ -26,8 +34,13 @@ LL | fn move_in_fn_arg(S {f:_s}: S) { | ^^^^^--^ | | | | | 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 diff --git a/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.nll.stderr index c69ae8755a9..278c33c71e2 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.nll.stderr @@ -4,10 +4,13 @@ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait 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 @@ -16,7 +19,12 @@ LL | let S(_s) = S("foo".to_string()); | -- ^^^^^^^^^^^^^^^^^^^^ 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 @@ -25,8 +33,13 @@ LL | fn move_in_fn_arg(S(_s): S) { | ^^--^ | | | | | 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 diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr index 4a72d7f3302..92e10c258c2 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr @@ -5,7 +5,7 @@ LL | let bad = v[0]; | ^^^^ | | | 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 diff --git a/src/test/ui/by-move-pattern-binding.nll.stderr b/src/test/ui/by-move-pattern-binding.nll.stderr index 4ba9b3aeb5d..491b5b5bd74 100644 --- a/src/test/ui/by-move-pattern-binding.nll.stderr +++ b/src/test/ui/by-move-pattern-binding.nll.stderr @@ -5,10 +5,16 @@ LL | match &s.x { | ^^^^ 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 diff --git a/src/test/ui/check-static-values-constraints.nll.stderr b/src/test/ui/check-static-values-constraints.nll.stderr index b265ec8bdda..5522e22fb1f 100644 --- a/src/test/ui/check-static-values-constraints.nll.stderr +++ b/src/test/ui/check-static-values-constraints.nll.stderr @@ -56,7 +56,7 @@ LL | let y = { static x: Box = box 3; x }; | ^ | | | 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 diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr index a8be048d7df..8e059937028 100644 --- a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr +++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr @@ -5,7 +5,12 @@ LL | let X { x: y } = x; //~ ERROR cannot move out of type | - ^ 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 diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.nll.stderr b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.nll.stderr index 9f0d2d5f0e1..dd1a3ef2a2b 100644 --- a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.nll.stderr +++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.nll.stderr @@ -4,10 +4,13 @@ error[E0509]: cannot move out of type `X`, which implements the `Drop` trait 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 diff --git a/src/test/ui/moves/move-out-of-slice-1.nll.stderr b/src/test/ui/moves/move-out-of-slice-1.nll.stderr index b061b6a7963..aa62b457ecd 100644 --- a/src/test/ui/moves/move-out-of-slice-1.nll.stderr +++ b/src/test/ui/moves/move-out-of-slice-1.nll.stderr @@ -4,10 +4,13 @@ error[E0508]: cannot move out of type `[A]`, a non-copy slice 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