From 9a0020a8794d8bcb7551e3c22bb345ee3c2b4343 Mon Sep 17 00:00:00 2001 From: ashtneoi Date: Mon, 13 Aug 2018 16:45:40 -0700 Subject: [PATCH] Bless UI tests --- .../borrowck-move-error-with-note.nll.stderr | 39 ++++++-- .../borrowck-move-out-of-vec-tail.nll.stderr | 17 +++- .../borrowck-vec-pattern-nesting.nll.stderr | 62 ++++++++---- src/test/ui/borrowck/issue-51415.nll.stderr | 7 +- .../overlapping_spans.nll.stderr | 11 ++- src/test/ui/issues/issue-12567.nll.stderr | 30 +++--- src/test/ui/issues/issue-20801.nll.stderr | 8 +- .../issue-40402-1.nll.stderr | 2 +- .../issue-40402-2.nll.stderr | 12 ++- .../moves-based-on-type-block-bad.nll.stderr | 10 +- .../ui/nll/cannot-move-block-spans.nll.stderr | 18 ++-- src/test/ui/nll/move-errors.stderr | 94 +++++++++++++------ .../ui/suggestions/dont-suggest-ref.stderr | 42 ++++----- 13 files changed, 231 insertions(+), 121 deletions(-) diff --git a/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr b/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr index 1b913471924..2df520a936c 100644 --- a/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr @@ -5,14 +5,24 @@ LL | match *f { //~ ERROR cannot move out of | ^^ | | | cannot move out of borrowed content - | help: consider removing this dereference operator: `f` + | help: consider removing the `*`: `f` LL | //~| cannot move out LL | Foo::Foo1(num1, - | ---- move occurs because num1 has type `std::boxed::Box`, which does not implement the `Copy` trait + | ---- data moved here LL | num2) => (), - | ---- move occurs because num2 has type `std::boxed::Box`, which does not implement the `Copy` trait + | ---- ...and here LL | Foo::Foo2(num) => (), - | --- move occurs because num has type `std::boxed::Box`, which does not implement the `Copy` trait + | --- ...and here + | +note: move occurs because these variables have types that don't implement the `Copy` trait + --> $DIR/borrowck-move-error-with-note.rs:23:19 + | +LL | Foo::Foo1(num1, + | ^^^^ +LL | num2) => (), + | ^^^^ +LL | Foo::Foo2(num) => (), + | ^^^ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait --> $DIR/borrowck-move-error-with-note.rs:39:11 @@ -23,12 +33,15 @@ LL | match (S {f: "foo".to_string(), g: "bar".to_string()}) { LL | f: _s, | -- data moved here LL | g: _t - | -- ... and here -help: to prevent move, use ref or ref mut + | -- ...and here | -LL | f: ref _s, -LL | g: ref _t +note: move occurs because these variables have types that don't implement the `Copy` trait + --> $DIR/borrowck-move-error-with-note.rs:42:16 | +LL | f: _s, + | ^^ +LL | g: _t + | ^^ error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-move-error-with-note.rs:57:11 @@ -37,10 +50,16 @@ LL | match a.a { //~ ERROR cannot move out of | ^^^ | | | cannot move out of borrowed content - | help: consider using a reference instead: `&a.a` + | help: consider borrowing here: `&a.a` LL | //~| cannot move out LL | n => { - | - move occurs because n has type `std::boxed::Box`, which does not implement the `Copy` trait + | - data moved here + | +note: move occurs because `n` has type `std::boxed::Box`, which does not implement the `Copy` trait + --> $DIR/borrowck-move-error-with-note.rs:59:9 + | +LL | n => { + | ^ error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr index 95a7894d532..f3430ba4e06 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr @@ -7,14 +7,23 @@ LL | &[Foo { string: a }, | - data moved here ... LL | Foo { string: b }] => { - | - ... and here -help: to prevent move, use ref or ref mut + | - ...and here | -LL | &[Foo { string: ref a }, +note: move occurs because these variables have types that don't implement the `Copy` trait + --> $DIR/borrowck-move-out-of-vec-tail.rs:30:33 + | +LL | &[Foo { string: a }, + | ^ +... +LL | Foo { string: b }] => { + | ^ +help: consider removing the `&` + | +LL | [Foo { string: a }, LL | //~^ ERROR cannot move out of type `[Foo]` LL | //~| cannot move out LL | //~| to prevent move -LL | Foo { string: ref b }] => { +LL | Foo { string: b }] => { | error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr index 2779132590e..d5b17119d85 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr @@ -28,10 +28,21 @@ error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy sli LL | match vec { | ^^^ cannot move out of here LL | &mut [_a, //~ ERROR cannot move out - | -- - | | - | data moved here - | help: to prevent move, use ref or ref mut: `ref _a` + | -- data moved here + | +note: move occurs because `_a` has type `std::boxed::Box`, which does not implement the `Copy` trait + --> $DIR/borrowck-vec-pattern-nesting.rs:44:15 + | +LL | &mut [_a, //~ ERROR cannot move out + | ^^ +help: consider removing the `&mut` + | +LL | [_a, //~ ERROR cannot move out +LL | //~| cannot move out +LL | //~| to prevent move +LL | .. +LL | ] => { + | error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:57:13 @@ -40,7 +51,7 @@ LL | let a = vec[0]; //~ ERROR cannot move out | ^^^^^^ | | | cannot move out of here - | help: consider using a reference instead: `&vec[0]` + | help: consider borrowing here: `&vec[0]` error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:64:11 @@ -49,10 +60,19 @@ LL | match vec { | ^^^ cannot move out of here ... LL | _b] => {} - | -- - | | - | data moved here - | help: to prevent move, use ref or ref mut: `ref _b` + | -- data moved here + | +note: move occurs because `_b` has type `std::boxed::Box`, which does not implement the `Copy` trait + --> $DIR/borrowck-vec-pattern-nesting.rs:67:10 + | +LL | _b] => {} + | ^^ +help: consider removing the `&mut` + | +LL | [ //~ ERROR cannot move out +LL | //~^ cannot move out +LL | _b] => {} + | error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:70:13 @@ -61,7 +81,7 @@ LL | let a = vec[0]; //~ ERROR cannot move out | ^^^^^^ | | | cannot move out of here - | help: consider using a reference instead: `&vec[0]` + | help: consider borrowing here: `&vec[0]` error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:77:11 @@ -69,14 +89,18 @@ error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy sli LL | match vec { | ^^^ cannot move out of here LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out - | -- -- -- ... and here - | | | - | | ... and here - | data moved here -help: to prevent move, use ref or ref mut - | -LL | &mut [ref _a, ref _b, ref _c] => {} //~ ERROR cannot move out - | ^^^^^^ ^^^^^^ ^^^^^^ + | ----------------- + | | | | | + | | | | ...and here + | | | ...and here + | | data moved here + | help: consider removing the `&mut`: `[_a, _b, _c]` + | +note: move occurs because these variables have types that don't implement the `Copy` trait + --> $DIR/borrowck-vec-pattern-nesting.rs:78:15 + | +LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out + | ^^ ^^ ^^ error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:82:13 @@ -85,7 +109,7 @@ LL | let a = vec[0]; //~ ERROR cannot move out | ^^^^^^ | | | cannot move out of here - | help: consider using a reference instead: `&vec[0]` + | help: consider borrowing here: `&vec[0]` error: aborting due to 8 previous errors diff --git a/src/test/ui/borrowck/issue-51415.nll.stderr b/src/test/ui/borrowck/issue-51415.nll.stderr index 20713c3392e..d4340938eeb 100644 --- a/src/test/ui/borrowck/issue-51415.nll.stderr +++ b/src/test/ui/borrowck/issue-51415.nll.stderr @@ -5,8 +5,13 @@ LL | let opt = a.iter().enumerate().find(|(_, &s)| { | ^^^^^-^ | | | | | data moved here - | | help: to prevent move, use ref or ref mut: `ref s` | cannot move out of borrowed content + | +note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait + --> $DIR/issue-51415.rs:16:47 + | +LL | let opt = a.iter().enumerate().find(|(_, &s)| { + | ^ error: aborting due to previous error diff --git a/src/test/ui/codemap_tests/overlapping_spans.nll.stderr b/src/test/ui/codemap_tests/overlapping_spans.nll.stderr index a1fbcf1430d..e334472f9d6 100644 --- a/src/test/ui/codemap_tests/overlapping_spans.nll.stderr +++ b/src/test/ui/codemap_tests/overlapping_spans.nll.stderr @@ -4,10 +4,13 @@ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait LL | match (S {f:"foo".to_string()}) { | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here LL | S {f:_s} => {} //~ ERROR cannot move out - | -- - | | - | 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/overlapping_spans.rs:21:14 + | +LL | S {f:_s} => {} //~ ERROR cannot move out + | ^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-12567.nll.stderr b/src/test/ui/issues/issue-12567.nll.stderr index 29bda252b91..72d21d47d86 100644 --- a/src/test/ui/issues/issue-12567.nll.stderr +++ b/src/test/ui/issues/issue-12567.nll.stderr @@ -8,15 +8,16 @@ LL | (&[], &[hd, ..]) | (&[hd, ..], &[]) | -- data moved here ... LL | (&[hd1, ..], &[hd2, ..]) - | --- ... and here -help: to prevent move, use ref or ref mut + | --- ...and here | -LL | (&[], &[ref hd, ..]) | (&[hd, ..], &[]) -LL | => println!("one empty"), -LL | //~^^ ERROR: cannot move out of type `[T]`, a non-copy slice -LL | //~^^^ ERROR: cannot move out of type `[T]`, a non-copy slice -LL | (&[hd1, ..], &[ref hd2, ..]) +note: move occurs because these variables have types that don't implement the `Copy` trait + --> $DIR/issue-12567.rs:16:17 | +LL | (&[], &[hd, ..]) | (&[hd, ..], &[]) + | ^^ +... +LL | (&[hd1, ..], &[hd2, ..]) + | ^^^ error[E0508]: cannot move out of type `[T]`, a non-copy slice --> $DIR/issue-12567.rs:14:11 @@ -28,15 +29,16 @@ LL | (&[], &[hd, ..]) | (&[hd, ..], &[]) | -- data moved here ... LL | (&[hd1, ..], &[hd2, ..]) - | --- ... and here -help: to prevent move, use ref or ref mut + | --- ...and here | -LL | (&[], &[ref hd, ..]) | (&[hd, ..], &[]) -LL | => println!("one empty"), -LL | //~^^ ERROR: cannot move out of type `[T]`, a non-copy slice -LL | //~^^^ ERROR: cannot move out of type `[T]`, a non-copy slice -LL | (&[ref hd1, ..], &[hd2, ..]) +note: move occurs because these variables have types that don't implement the `Copy` trait + --> $DIR/issue-12567.rs:16:17 | +LL | (&[], &[hd, ..]) | (&[hd, ..], &[]) + | ^^ +... +LL | (&[hd1, ..], &[hd2, ..]) + | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-20801.nll.stderr b/src/test/ui/issues/issue-20801.nll.stderr index fc94cc423c5..3a6784eed67 100644 --- a/src/test/ui/issues/issue-20801.nll.stderr +++ b/src/test/ui/issues/issue-20801.nll.stderr @@ -5,7 +5,7 @@ LL | let a = unsafe { *mut_ref() }; | ^^^^^^^^^^ | | | cannot move out of borrowed content - | help: consider using a reference instead: `&*mut_ref()` + | help: consider removing the `*`: `mut_ref()` error[E0507]: cannot move out of borrowed content --> $DIR/issue-20801.rs:39:22 @@ -14,7 +14,7 @@ LL | let b = unsafe { *imm_ref() }; | ^^^^^^^^^^ | | | cannot move out of borrowed content - | help: consider using a reference instead: `&*imm_ref()` + | help: consider removing the `*`: `imm_ref()` error[E0507]: cannot move out of borrowed content --> $DIR/issue-20801.rs:42:22 @@ -23,7 +23,7 @@ LL | let c = unsafe { *mut_ptr() }; | ^^^^^^^^^^ | | | cannot move out of borrowed content - | help: consider using a reference instead: `&*mut_ptr()` + | help: consider removing the `*`: `mut_ptr()` error[E0507]: cannot move out of borrowed content --> $DIR/issue-20801.rs:45:22 @@ -32,7 +32,7 @@ LL | let d = unsafe { *const_ptr() }; | ^^^^^^^^^^^^ | | | cannot move out of borrowed content - | help: consider using a reference instead: `&*const_ptr()` + | help: consider removing the `*`: `const_ptr()` error: aborting due to 4 previous errors diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr index 162e43abc0a..9020d3778c3 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr @@ -5,7 +5,7 @@ LL | let e = f.v[0]; //~ ERROR cannot move out of indexed content | ^^^^^^ | | | cannot move out of borrowed content - | help: consider using a reference instead: `&f.v[0]` + | help: consider borrowing here: `&f.v[0]` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr index cd75be24589..a80e9a5fe09 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr @@ -5,9 +5,15 @@ LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content | - - ^^^^ | | | | | | | cannot move out of borrowed content - | | | help: consider using a reference instead: `&x[0]` - | | move occurs because b has type `std::string::String`, which does not implement the `Copy` trait - | move occurs because a has type `std::string::String`, which does not implement the `Copy` trait + | | | help: consider borrowing here: `&x[0]` + | | ...and here + | data moved here + | +note: move occurs because these variables have types that don't implement the `Copy` trait + --> $DIR/issue-40402-2.rs:15:10 + | +LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content + | ^ ^ error: aborting due to previous error diff --git a/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr b/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr index 94f2074b45d..1f22ab14818 100644 --- a/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr @@ -5,10 +5,16 @@ LL | match hellothere.x { //~ ERROR cannot move out | ^^^^^^^^^^^^ | | | cannot move out of borrowed content - | help: consider using a reference instead: `&hellothere.x` + | help: consider borrowing here: `&hellothere.x` ... LL | box E::Bar(x) => println!("{}", x.to_string()), - | - move occurs because x has type `std::boxed::Box`, which does not implement the `Copy` trait + | - data moved here + | +note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait + --> $DIR/moves-based-on-type-block-bad.rs:37:28 + | +LL | box E::Bar(x) => println!("{}", x.to_string()), + | ^ error: aborting due to previous error diff --git a/src/test/ui/nll/cannot-move-block-spans.nll.stderr b/src/test/ui/nll/cannot-move-block-spans.nll.stderr index 814e11b6f06..6a4c8f2e8d8 100644 --- a/src/test/ui/nll/cannot-move-block-spans.nll.stderr +++ b/src/test/ui/nll/cannot-move-block-spans.nll.stderr @@ -5,7 +5,7 @@ LL | let x = { *r }; //~ ERROR | ^^ | | | cannot move out of borrowed content - | help: consider removing this dereference operator: `r` + | help: consider removing the `*`: `r` error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:16:22 @@ -14,7 +14,7 @@ LL | let y = unsafe { *r }; //~ ERROR | ^^ | | | cannot move out of borrowed content - | help: consider removing this dereference operator: `r` + | help: consider removing the `*`: `r` error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:17:26 @@ -23,7 +23,7 @@ LL | let z = loop { break *r; }; //~ ERROR | ^^ | | | cannot move out of borrowed content - | help: consider removing this dereference operator: `r` + | help: consider removing the `*`: `r` error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:21:15 @@ -32,7 +32,7 @@ LL | let x = { arr[0] }; //~ ERROR | ^^^^^^ | | | cannot move out of here - | help: consider using a reference instead: `&arr[0]` + | help: consider borrowing here: `&arr[0]` error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:22:22 @@ -41,7 +41,7 @@ LL | let y = unsafe { arr[0] }; //~ ERROR | ^^^^^^ | | | cannot move out of here - | help: consider using a reference instead: `&arr[0]` + | help: consider borrowing here: `&arr[0]` error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:23:26 @@ -50,7 +50,7 @@ LL | let z = loop { break arr[0]; }; //~ ERROR | ^^^^^^ | | | cannot move out of here - | help: consider using a reference instead: `&arr[0]` + | help: consider borrowing here: `&arr[0]` error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:27:38 @@ -59,7 +59,7 @@ LL | let x = { let mut u = 0; u += 1; *r }; //~ ERROR | ^^ | | | cannot move out of borrowed content - | help: consider removing this dereference operator: `r` + | help: consider removing the `*`: `r` error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:28:45 @@ -68,7 +68,7 @@ LL | let y = unsafe { let mut u = 0; u += 1; *r }; //~ ERROR | ^^ | | | cannot move out of borrowed content - | help: consider removing this dereference operator: `r` + | help: consider removing the `*`: `r` error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:29:49 @@ -77,7 +77,7 @@ LL | let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; //~ ERROR | ^^ | | | cannot move out of borrowed content - | help: consider removing this dereference operator: `r` + | help: consider removing the `*`: `r` error: aborting due to 9 previous errors diff --git a/src/test/ui/nll/move-errors.stderr b/src/test/ui/nll/move-errors.stderr index 53d60d3f6d6..59276836309 100644 --- a/src/test/ui/nll/move-errors.stderr +++ b/src/test/ui/nll/move-errors.stderr @@ -5,7 +5,7 @@ LL | let b = *a; | ^^ | | | cannot move out of borrowed content - | help: consider removing this dereference operator: `a` + | help: consider removing the `*`: `a` error[E0508]: cannot move out of type `[A; 1]`, a non-copy array --> $DIR/move-errors.rs:25:13 @@ -14,7 +14,7 @@ LL | let b = a[0]; | ^^^^ | | | cannot move out of here - | help: consider using a reference instead: `&a[0]` + | help: consider borrowing here: `&a[0]` error[E0507]: cannot move out of borrowed content --> $DIR/move-errors.rs:32:13 @@ -23,7 +23,7 @@ LL | let s = **r; | ^^^ | | | cannot move out of borrowed content - | help: consider using a reference instead: `&**r` + | help: consider removing the `*`: `*r` error[E0507]: cannot move out of borrowed content --> $DIR/move-errors.rs:40:13 @@ -32,7 +32,7 @@ LL | let s = *r; | ^^ | | | cannot move out of borrowed content - | help: consider using a reference instead: `&*r` + | help: consider removing the `*`: `r` error[E0508]: cannot move out of type `[A; 1]`, a non-copy array --> $DIR/move-errors.rs:45:13 @@ -41,7 +41,7 @@ LL | let a = [A("".to_string())][0]; | ^^^^^^^^^^^^^^^^^^^^^^ | | | cannot move out of here - | help: consider using a reference instead: `&[A("".to_string())][0]` + | help: consider borrowing here: `&[A("".to_string())][0]` error[E0507]: cannot move out of borrowed content --> $DIR/move-errors.rs:51:16 @@ -50,8 +50,14 @@ LL | let A(s) = *a; | - ^^ | | | | | cannot move out of borrowed content - | | help: consider removing this dereference operator: `a` - | move occurs because s has type `std::string::String`, which does not implement the `Copy` trait + | | help: consider removing the `*`: `a` + | data moved here + | +note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait + --> $DIR/move-errors.rs:51:11 + | +LL | let A(s) = *a; + | ^ error[E0509]: cannot move out of type `D`, which implements the `Drop` trait --> $DIR/move-errors.rs:57:19 @@ -60,7 +66,12 @@ LL | let C(D(s)) = c; | - ^ 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/move-errors.rs:57:13 + | +LL | let C(D(s)) = c; + | ^ error[E0507]: cannot move out of borrowed content --> $DIR/move-errors.rs:64:9 @@ -75,12 +86,20 @@ LL | match x[0] { | ^^^^ | | | cannot move out of here - | help: consider using a reference instead: `&x[0]` + | help: consider borrowing here: `&x[0]` LL | //~^ ERROR LL | B::U(d) => (), - | - move occurs because d has type `D`, which does not implement the `Copy` trait + | - data moved here LL | B::V(s) => (), - | - move occurs because s has type `std::string::String`, which does not implement the `Copy` trait + | - ...and here + | +note: move occurs because these variables have types that don't implement the `Copy` trait + --> $DIR/move-errors.rs:89:14 + | +LL | B::U(d) => (), + | ^ +LL | B::V(s) => (), + | ^ error[E0509]: cannot move out of type `D`, which implements the `Drop` trait --> $DIR/move-errors.rs:96:11 @@ -89,10 +108,13 @@ LL | match x { | ^ cannot move out of here ... LL | B::U(D(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/move-errors.rs:99:16 + | +LL | B::U(D(s)) => (), + | ^ error[E0509]: cannot move out of type `D`, which implements the `Drop` trait --> $DIR/move-errors.rs:105:11 @@ -101,10 +123,13 @@ LL | match x { | ^ cannot move out of here ... LL | (D(s), &t) => (), - | - - | | - | 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/move-errors.rs:108:12 + | +LL | (D(s), &t) => (), + | ^ error[E0507]: cannot move out of borrowed content --> $DIR/move-errors.rs:105:11 @@ -113,10 +138,13 @@ LL | match x { | ^ cannot move out of borrowed content ... LL | (D(s), &t) => (), - | - - | | - | data moved here - | help: to prevent move, use ref or ref mut: `ref t` + | - data moved here + | +note: move occurs because `t` has type `std::string::String`, which does not implement the `Copy` trait + --> $DIR/move-errors.rs:108:17 + | +LL | (D(s), &t) => (), + | ^ error[E0509]: cannot move out of type `F`, which implements the `Drop` trait --> $DIR/move-errors.rs:115:11 @@ -125,13 +153,15 @@ LL | match x { | ^ cannot move out of here LL | //~^ ERROR LL | F(s, mut t) => (), - | - ----- ... and here + | - ----- ...and here | | | data moved here -help: to prevent move, use ref or ref mut | -LL | F(ref s, ref mut t) => (), - | ^^^^^ ^^^^^^^^^ +note: move occurs because these variables have types that don't implement the `Copy` trait + --> $DIR/move-errors.rs:117:11 + | +LL | F(s, mut t) => (), + | ^ ^^^^^ error[E0507]: cannot move out of borrowed content --> $DIR/move-errors.rs:123:11 @@ -140,10 +170,16 @@ LL | match *x { | ^^ | | | cannot move out of borrowed content - | help: consider removing this dereference operator: `x` + | help: consider removing the `*`: `x` LL | //~^ ERROR LL | Ok(s) | Err(s) => (), - | - move occurs because s has type `std::string::String`, which does not implement the `Copy` trait + | - data moved here + | +note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait + --> $DIR/move-errors.rs:125:12 + | +LL | Ok(s) | Err(s) => (), + | ^ error: aborting due to 14 previous errors diff --git a/src/test/ui/suggestions/dont-suggest-ref.stderr b/src/test/ui/suggestions/dont-suggest-ref.stderr index 00fe78d9164..7d365e8788f 100644 --- a/src/test/ui/suggestions/dont-suggest-ref.stderr +++ b/src/test/ui/suggestions/dont-suggest-ref.stderr @@ -524,7 +524,7 @@ LL | &mut Either::One(_t) => (), | -- data moved here ... LL | &mut Either::Two(_t) => (), - | -- ... and here + | -- ...and here | note: move occurs because these variables have types that don't implement the `Copy` trait --> $DIR/dont-suggest-ref.rs:233:26 @@ -705,7 +705,7 @@ LL | //~^ ERROR cannot move LL | (&mut Either::One(_t),) => (), | -- data moved here LL | (&mut Either::Two(_t),) => (), - | -- ... and here + | -- ...and here | note: move occurs because these variables have types that don't implement the `Copy` trait --> $DIR/dont-suggest-ref.rs:290:27 @@ -937,7 +937,7 @@ error[E0507]: cannot move out of borrowed content LL | let &(X(_t), X(_u)) = &(x.clone(), x.clone()); | --------------- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content | | | | - | | | ... and here + | | | ...and here | | data moved here | help: consider removing the `&`: `(X(_t), X(_u))` | @@ -953,7 +953,7 @@ error[E0507]: cannot move out of borrowed content LL | if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } | ----------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content | | | | - | | | ... and here + | | | ...and here | | data moved here | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))` | @@ -969,7 +969,7 @@ error[E0507]: cannot move out of borrowed content LL | while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } | ----------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content | | | | - | | | ... and here + | | | ...and here | | data moved here | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))` | @@ -986,12 +986,12 @@ LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content LL | //~^ ERROR cannot move LL | &(Either::One(_t), Either::Two(_u)) => (), - | -- -- ... and here + | -- -- ...and here | | | data moved here ... LL | &(Either::Two(_t), Either::One(_u)) => (), - | -- ... and here -- ... and here + | -- ...and here -- ...and here | note: move occurs because these variables have types that don't implement the `Copy` trait --> $DIR/dont-suggest-ref.rs:391:23 @@ -1019,7 +1019,7 @@ LL | //~^ ERROR cannot move LL | &(Either::One(_t), Either::Two(_u)) | ----------------------------------- | | | | - | | | ... and here + | | | ...and here | | data moved here | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))` | @@ -1038,7 +1038,7 @@ LL | //~^ ERROR cannot move LL | &(Either::One(_t), Either::Two(_u)) => (), | ----------------------------------- | | | | - | | | ... and here + | | | ...and here | | data moved here | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))` | @@ -1057,7 +1057,7 @@ LL | //~^ ERROR cannot move LL | &(Either::One(_t), Either::Two(_u)) => (), | ----------------------------------- | | | | - | | | ... and here + | | | ...and here | | data moved here | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))` | @@ -1073,7 +1073,7 @@ error[E0507]: cannot move out of borrowed content LL | let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone()); | ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content | | | | - | | | ... and here + | | | ...and here | | data moved here | help: consider removing the `&mut`: `(X(_t), X(_u))` | @@ -1089,7 +1089,7 @@ error[E0507]: cannot move out of borrowed content LL | if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { } | --------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content | | | | - | | | ... and here + | | | ...and here | | data moved here | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` | @@ -1105,7 +1105,7 @@ error[E0507]: cannot move out of borrowed content LL | while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { } | --------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content | | | | - | | | ... and here + | | | ...and here | | data moved here | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` | @@ -1122,12 +1122,12 @@ LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content LL | //~^ ERROR cannot move LL | &mut (Either::One(_t), Either::Two(_u)) => (), - | -- -- ... and here + | -- -- ...and here | | | data moved here ... LL | &mut (Either::Two(_t), Either::One(_u)) => (), - | -- ... and here -- ... and here + | -- ...and here -- ...and here | note: move occurs because these variables have types that don't implement the `Copy` trait --> $DIR/dont-suggest-ref.rs:443:27 @@ -1155,7 +1155,7 @@ LL | //~^ ERROR cannot move LL | &mut (Either::One(_t), Either::Two(_u)) | --------------------------------------- | | | | - | | | ... and here + | | | ...and here | | data moved here | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` | @@ -1174,7 +1174,7 @@ LL | //~^ ERROR cannot move LL | &mut (Either::One(_t), Either::Two(_u)) => (), | --------------------------------------- | | | | - | | | ... and here + | | | ...and here | | data moved here | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` | @@ -1193,7 +1193,7 @@ LL | //~^ ERROR cannot move LL | &mut (Either::One(_t), Either::Two(_u)) => (), | --------------------------------------- | | | | - | | | ... and here + | | | ...and here | | data moved here | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` | @@ -1212,7 +1212,7 @@ LL | //~^ ERROR cannot move LL | &mut (Either::One(_t), Either::Two(_u)) => (), | --------------------------------------- | | | | - | | | ... and here + | | | ...and here | | data moved here | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` | @@ -1290,7 +1290,7 @@ error[E0507]: cannot move out of borrowed content LL | fn f5(&(X(_t), X(_u)): &(X, X)) { } | ^^^^--^^^^^--^^ | | | | - | | | ... and here + | | | ...and here | | data moved here | cannot move out of borrowed content | help: consider removing the `&`: `(X(_t), X(_u))` @@ -1307,7 +1307,7 @@ error[E0507]: cannot move out of borrowed content LL | fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { } | ^^^^^^^^--^^^^^--^^ | | | | - | | | ... and here + | | | ...and here | | data moved here | cannot move out of borrowed content | help: consider removing the `&mut`: `(X(_t), X(_u))` -- GitLab