diff options
| author | Matthew Jasper <mjjasper1@gmail.com> | 2018-06-27 22:07:20 +0100 |
|---|---|---|
| committer | Matthew Jasper <mjjasper1@gmail.com> | 2018-06-27 22:46:58 +0100 |
| commit | 2cb0a0631a640318ae288ead20758db8508f6835 (patch) | |
| tree | effff316398cd1155683847366e1e77bd01b7a62 | |
| parent | 0193d1f736b755004e15b7c1bc41467b177845cf (diff) | |
| download | rust-2cb0a0631a640318ae288ead20758db8508f6835.tar.gz rust-2cb0a0631a640318ae288ead20758db8508f6835.zip | |
Update tests for grouped nll move errors
| -rw-r--r-- | src/test/compile-fail/borrowck/borrowck-move-out-of-struct-with-dtor.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/E0508.ast.nll.stderr | 9 | ||||
| -rw-r--r-- | src/test/ui/E0508.mir.stderr | 9 | ||||
| -rw-r--r-- | src/test/ui/E0508.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/E0508.stderr (renamed from src/test/ui/E0508.ast.stderr) | 4 | ||||
| -rw-r--r-- | src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr | 52 | ||||
| -rw-r--r-- | src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr | 20 | ||||
| -rw-r--r-- | src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr | 56 | ||||
| -rw-r--r-- | src/test/ui/borrowck/issue-51415.nll.stderr | 7 | ||||
| -rw-r--r-- | src/test/ui/codemap_tests/overlapping_spans.nll.stderr | 6 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0509.nll.stderr | 9 | ||||
| -rw-r--r-- | src/test/ui/issue-40402-ref-hints/issue-40402-1.nll.stderr | 5 | ||||
| -rw-r--r-- | src/test/ui/issue-40402-ref-hints/issue-40402-2.nll.stderr | 17 | ||||
| -rw-r--r-- | src/test/ui/moves-based-on-type-block-bad.nll.stderr | 10 | ||||
| -rw-r--r-- | src/test/ui/nll/move-errors.rs | 130 | ||||
| -rw-r--r-- | src/test/ui/nll/move-errors.stderr | 140 |
16 files changed, 378 insertions, 104 deletions
diff --git a/src/test/compile-fail/borrowck/borrowck-move-out-of-struct-with-dtor.rs b/src/test/compile-fail/borrowck/borrowck-move-out-of-struct-with-dtor.rs index 8e1f7c72914..4bb66ace026 100644 --- a/src/test/compile-fail/borrowck/borrowck-move-out-of-struct-with-dtor.rs +++ b/src/test/compile-fail/borrowck/borrowck-move-out-of-struct-with-dtor.rs @@ -18,9 +18,9 @@ impl Drop for S { fn move_in_match() { match (S {f:"foo".to_string()}) { + //[mir]~^ ERROR [E0509] S {f:_s} => {} //[ast]~^ ERROR cannot move out of type `S`, which implements the `Drop` trait [E0509] - //[mir]~^^ ERROR [E0509] } } diff --git a/src/test/ui/E0508.ast.nll.stderr b/src/test/ui/E0508.ast.nll.stderr deleted file mode 100644 index 28403644a23..00000000000 --- a/src/test/ui/E0508.ast.nll.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array - --> $DIR/E0508.rs:18:18 - | -LL | let _value = array[0]; //[ast]~ ERROR [E0508] - | ^^^^^^^^ cannot move out of here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0508`. diff --git a/src/test/ui/E0508.mir.stderr b/src/test/ui/E0508.mir.stderr deleted file mode 100644 index 28403644a23..00000000000 --- a/src/test/ui/E0508.mir.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array - --> $DIR/E0508.rs:18:18 - | -LL | let _value = array[0]; //[ast]~ ERROR [E0508] - | ^^^^^^^^ cannot move out of here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0508`. diff --git a/src/test/ui/E0508.rs b/src/test/ui/E0508.rs index 0c3dce6b034..86445ad8982 100644 --- a/src/test/ui/E0508.rs +++ b/src/test/ui/E0508.rs @@ -8,13 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// revisions: ast mir -//[mir]compile-flags: -Z borrowck=mir - struct NonCopy; fn main() { let array = [NonCopy; 1]; - let _value = array[0]; //[ast]~ ERROR [E0508] - //[mir]~^ ERROR [E0508] + let _value = array[0]; //~ ERROR [E0508] } diff --git a/src/test/ui/E0508.ast.stderr b/src/test/ui/E0508.stderr index 5878b795b77..28ce0d971c6 100644 --- a/src/test/ui/E0508.ast.stderr +++ b/src/test/ui/E0508.stderr @@ -1,7 +1,7 @@ error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array - --> $DIR/E0508.rs:18:18 + --> $DIR/E0508.rs:15:18 | -LL | let _value = array[0]; //[ast]~ ERROR [E0508] +LL | let _value = array[0]; //~ ERROR [E0508] | ^^^^^^^^ | | | cannot move out of here 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 c563a28b317..a34c97974da 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 @@ -1,40 +1,46 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-move-error-with-note.rs:23:19 + --> $DIR/borrowck-move-error-with-note.rs:21:11 | +LL | match *f { //~ ERROR cannot move out of + | ^^ + | | + | cannot move out of borrowed content + | help: consider removing this dereference operator: `f` +LL | //~| cannot move out LL | Foo::Foo1(num1, - | ^^^^ cannot move out of borrowed content - -error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-move-error-with-note.rs:24:19 - | + | ---- move occurs because num1 has type `std::boxed::Box<u32>`, which does not implement the `Copy` trait LL | num2) => (), - | ^^^^ cannot move out of borrowed content - -error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-move-error-with-note.rs:25:19 - | + | ---- move occurs because num2 has type `std::boxed::Box<u32>`, which does not implement the `Copy` trait LL | Foo::Foo2(num) => (), - | ^^^ cannot move out of borrowed content + | --- move occurs because num has type `std::boxed::Box<u32>`, which does not implement the `Copy` trait error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-error-with-note.rs:42:16 + --> $DIR/borrowck-move-error-with-note.rs:39:11 | -LL | f: _s, - | ^^ cannot move out of here - -error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-error-with-note.rs:43:16 +LL | match (S {f: "foo".to_string(), g: "bar".to_string()}) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here +help: to prevent move, use ref or ref mut + | +LL | f: ref _s, + | ^^^^^^ +help: to prevent move, use ref or ref mut | -LL | g: _t - | ^^ cannot move out of here +LL | g: ref _t + | ^^^^^^ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-move-error-with-note.rs:59:9 + --> $DIR/borrowck-move-error-with-note.rs:57:11 | +LL | match a.a { //~ ERROR cannot move out of + | ^^^ + | | + | cannot move out of borrowed content + | help: consider using a reference instead: `&a.a` +LL | //~| cannot move out LL | n => { - | ^ cannot move out of borrowed content + | - move occurs because n has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait -error: aborting due to 6 previous errors +error: aborting due to 3 previous errors Some errors occurred: E0507, E0509. For more information about an error, try `rustc --explain E0507`. 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 96b376ea7ae..d01b24507d9 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 @@ -1,15 +1,17 @@ error[E0508]: cannot move out of type `[Foo]`, a non-copy slice - --> $DIR/borrowck-move-out-of-vec-tail.rs:30:33 + --> $DIR/borrowck-move-out-of-vec-tail.rs:29:19 | -LL | &[Foo { string: a }, - | ^ cannot move out of here - -error[E0508]: cannot move out of type `[Foo]`, a non-copy slice - --> $DIR/borrowck-move-out-of-vec-tail.rs:34:33 +LL | match tail { + | ^^^^ cannot move out of here +help: to prevent move, use ref or ref mut + | +LL | &[Foo { string: ref a }, + | ^^^^^ +help: to prevent move, use ref or ref mut | -LL | Foo { string: b }] => { - | ^ cannot move out of here +LL | Foo { string: ref b }] => { + | ^^^^^ -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0508`. 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 6d28a37463b..50ef3ba40e7 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr @@ -23,54 +23,68 @@ LL | _b.use_ref(); | -- borrow later used here error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:44:15 + --> $DIR/borrowck-vec-pattern-nesting.rs:43:11 | +LL | match vec { + | ^^^ cannot move out of here LL | &mut [_a, //~ ERROR cannot move out - | ^^ cannot move out of here + | -- help: to prevent move, use ref or ref mut: `ref _a` error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:57:13 | LL | let a = vec[0]; //~ ERROR cannot move out - | ^^^^^^ cannot move out of here + | ^^^^^^ + | | + | cannot move out of here + | help: consider using a reference instead: `&vec[0]` error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:67:10 + --> $DIR/borrowck-vec-pattern-nesting.rs:64:11 | +LL | match vec { + | ^^^ cannot move out of here +... LL | _b] => {} - | ^^ cannot move out of here + | -- help: to prevent move, use ref or ref mut: `ref _b` error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:70:13 | LL | let a = vec[0]; //~ ERROR cannot move out - | ^^^^^^ cannot move out of here + | ^^^^^^ + | | + | cannot move out of here + | help: consider using a reference instead: `&vec[0]` error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:78:15 + --> $DIR/borrowck-vec-pattern-nesting.rs:77:11 | -LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out - | ^^ cannot move out of here - -error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:78:19 +LL | match vec { + | ^^^ cannot move out of here +help: to prevent move, use ref or ref mut | -LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out - | ^^ cannot move out of here - -error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:78:23 +LL | &mut [ref _a, _b, _c] => {} //~ ERROR cannot move out + | ^^^^^^ +help: to prevent move, use ref or ref mut + | +LL | &mut [_a, ref _b, _c] => {} //~ ERROR cannot move out + | ^^^^^^ +help: to prevent move, use ref or ref mut | -LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out - | ^^ cannot move out of here +LL | &mut [_a, _b, ref _c] => {} //~ ERROR cannot move out + | ^^^^^^ error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:82:13 | LL | let a = vec[0]; //~ ERROR cannot move out - | ^^^^^^ cannot move out of here + | ^^^^^^ + | | + | cannot move out of here + | help: consider using a reference instead: `&vec[0]` -error: aborting due to 10 previous errors +error: aborting due to 8 previous errors Some errors occurred: E0506, E0508. For more information about an error, try `rustc --explain E0506`. diff --git a/src/test/ui/borrowck/issue-51415.nll.stderr b/src/test/ui/borrowck/issue-51415.nll.stderr index 79454b63526..d872c7efe2b 100644 --- a/src/test/ui/borrowck/issue-51415.nll.stderr +++ b/src/test/ui/borrowck/issue-51415.nll.stderr @@ -1,8 +1,11 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/issue-51415.rs:16:47 + --> $DIR/issue-51415.rs:16:42 | LL | let opt = a.iter().enumerate().find(|(_, &s)| { - | ^ cannot move out of borrowed content + | ^^^^^-^ + | | | + | | help: to prevent move, use ref or ref mut: `ref s` + | cannot move out of borrowed content 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 b6630b2e666..34616a8de45 100644 --- a/src/test/ui/codemap_tests/overlapping_spans.nll.stderr +++ b/src/test/ui/codemap_tests/overlapping_spans.nll.stderr @@ -1,8 +1,10 @@ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/overlapping_spans.rs:21:14 + --> $DIR/overlapping_spans.rs:20:11 | +LL | match (S {f:"foo".to_string()}) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here LL | S {f:_s} => {} //~ ERROR cannot move out - | ^^ cannot move out of here + | -- help: to prevent move, use ref or ref mut: `ref _s` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0509.nll.stderr b/src/test/ui/error-codes/E0509.nll.stderr deleted file mode 100644 index 56d970494a0..00000000000 --- a/src/test/ui/error-codes/E0509.nll.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0509]: cannot move out of type `DropStruct`, which implements the `Drop` trait - --> $DIR/E0509.rs:26:23 - | -LL | let fancy_field = drop_struct.fancy; //~ ERROR E0509 - | ^^^^^^^^^^^^^^^^^ cannot move out of here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0509`. diff --git a/src/test/ui/issue-40402-ref-hints/issue-40402-1.nll.stderr b/src/test/ui/issue-40402-ref-hints/issue-40402-1.nll.stderr index 48e27014792..162e43abc0a 100644 --- a/src/test/ui/issue-40402-ref-hints/issue-40402-1.nll.stderr +++ b/src/test/ui/issue-40402-ref-hints/issue-40402-1.nll.stderr @@ -2,7 +2,10 @@ error[E0507]: cannot move out of borrowed content --> $DIR/issue-40402-1.rs:19:13 | LL | let e = f.v[0]; //~ ERROR cannot move out of indexed content - | ^^^^^^ cannot move out of borrowed content + | ^^^^^^ + | | + | cannot move out of borrowed content + | help: consider using a reference instead: `&f.v[0]` error: aborting due to previous error diff --git a/src/test/ui/issue-40402-ref-hints/issue-40402-2.nll.stderr b/src/test/ui/issue-40402-ref-hints/issue-40402-2.nll.stderr index 0b907c5acf1..cd75be24589 100644 --- a/src/test/ui/issue-40402-ref-hints/issue-40402-2.nll.stderr +++ b/src/test/ui/issue-40402-ref-hints/issue-40402-2.nll.stderr @@ -1,15 +1,14 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/issue-40402-2.rs:15:10 + --> $DIR/issue-40402-2.rs:15:18 | LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content - | ^ cannot move out of borrowed 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 -error[E0507]: cannot move out of borrowed content - --> $DIR/issue-40402-2.rs:15:13 - | -LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content - | ^ cannot move out of borrowed content - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/moves-based-on-type-block-bad.nll.stderr b/src/test/ui/moves-based-on-type-block-bad.nll.stderr index 942d9816c4e..94f2074b45d 100644 --- a/src/test/ui/moves-based-on-type-block-bad.nll.stderr +++ b/src/test/ui/moves-based-on-type-block-bad.nll.stderr @@ -1,8 +1,14 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/moves-based-on-type-block-bad.rs:37:28 + --> $DIR/moves-based-on-type-block-bad.rs:34:19 | +LL | match hellothere.x { //~ ERROR cannot move out + | ^^^^^^^^^^^^ + | | + | cannot move out of borrowed content + | help: consider using a reference instead: `&hellothere.x` +... LL | box E::Bar(x) => println!("{}", x.to_string()), - | ^ cannot move out of borrowed content + | - move occurs because x has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/nll/move-errors.rs b/src/test/ui/nll/move-errors.rs new file mode 100644 index 00000000000..6445f166b57 --- /dev/null +++ b/src/test/ui/nll/move-errors.rs @@ -0,0 +1,130 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(unused)] +#![feature(nll)] + +struct A(String); +struct C(D); + +fn suggest_remove_deref() { + let a = &A("".to_string()); + let b = *a; + //~^ ERROR +} + +fn suggest_borrow() { + let a = [A("".to_string())]; + let b = a[0]; + //~^ ERROR +} + +fn suggest_borrow2() { + let mut a = A("".to_string()); + let r = &&mut a; + let s = **r; + //~^ ERROR +} + +fn suggest_borrow3() { + use std::rc::Rc; + let mut a = A("".to_string()); + let r = Rc::new(a); + let s = *r; + //~^ ERROR +} + +fn suggest_borrow4() { + let a = [A("".to_string())][0]; + //~^ ERROR +} + +fn suggest_borrow5() { + let a = &A("".to_string()); + let A(s) = *a; + //~^ ERROR +} + +fn suggest_ref() { + let c = C(D(String::new())); + let C(D(s)) = c; + //~^ ERROR +} + +fn suggest_nothing() { + let a = &A("".to_string()); + let b; + b = *a; + //~^ ERROR +} + +enum B { + V(String), + U(D), +} + +struct D(String); + +impl Drop for D { + fn drop(&mut self) {} +} + +struct F(String, String); + +impl Drop for F { + fn drop(&mut self) {} +} + +fn probably_suggest_borrow() { + let x = [B::V(String::new())]; + match x[0] { + //~^ ERROR + B::U(d) => (), + B::V(s) => (), + } +} + +fn have_to_suggest_ref() { + let x = B::V(String::new()); + match x { + //~^ ERROR + B::V(s) => drop(s), + B::U(D(s)) => (), + }; +} + +fn two_separate_errors() { + let x = (D(String::new()), &String::new()); + match x { + //~^ ERROR + //~^^ ERROR + (D(s), &t) => (), + _ => (), + } +} + +fn have_to_suggest_double_ref() { + let x = F(String::new(), String::new()); + match x { + //~^ ERROR + F(s, mut t) => (), + _ => (), + } +} + +fn double_binding(x: &Result<String, String>) { + match *x { + //~^ ERROR + Ok(s) | Err(s) => (), + } +} + +fn main() { +} diff --git a/src/test/ui/nll/move-errors.stderr b/src/test/ui/nll/move-errors.stderr new file mode 100644 index 00000000000..3f2c651ae3a --- /dev/null +++ b/src/test/ui/nll/move-errors.stderr @@ -0,0 +1,140 @@ +error[E0507]: cannot move out of borrowed content + --> $DIR/move-errors.rs:19:13 + | +LL | let b = *a; + | ^^ + | | + | cannot move out of borrowed content + | help: consider removing this dereference operator: `a` + +error[E0508]: cannot move out of type `[A; 1]`, a non-copy array + --> $DIR/move-errors.rs:25:13 + | +LL | let b = a[0]; + | ^^^^ + | | + | cannot move out of here + | help: consider using a reference instead: `&a[0]` + +error[E0507]: cannot move out of borrowed content + --> $DIR/move-errors.rs:32:13 + | +LL | let s = **r; + | ^^^ + | | + | cannot move out of borrowed content + | help: consider using a reference instead: `&**r` + +error[E0507]: cannot move out of borrowed content + --> $DIR/move-errors.rs:40:13 + | +LL | let s = *r; + | ^^ + | | + | cannot move out of borrowed content + | help: consider using a reference instead: `&*r` + +error[E0508]: cannot move out of type `[A; 1]`, a non-copy array + --> $DIR/move-errors.rs:45:13 + | +LL | let a = [A("".to_string())][0]; + | ^^^^^^^^^^^^^^^^^^^^^^ + | | + | cannot move out of here + | help: consider using a reference instead: `&[A("".to_string())][0]` + +error[E0507]: cannot move out of borrowed content + --> $DIR/move-errors.rs:51:16 + | +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 + +error[E0509]: cannot move out of type `D`, which implements the `Drop` trait + --> $DIR/move-errors.rs:57:19 + | +LL | let C(D(s)) = c; + | - ^ cannot move out of here + | | + | help: to prevent move, use ref or ref mut: `ref s` + +error[E0507]: cannot move out of borrowed content + --> $DIR/move-errors.rs:64:9 + | +LL | b = *a; + | ^^ cannot move out of borrowed content + +error[E0508]: cannot move out of type `[B; 1]`, a non-copy array + --> $DIR/move-errors.rs:87:11 + | +LL | match x[0] { + | ^^^^ + | | + | cannot move out of here + | help: consider using a reference instead: `&x[0]` +LL | //~^ ERROR +LL | B::U(d) => (), + | - move occurs because d has type `D`, which does not implement the `Copy` trait +LL | B::V(s) => (), + | - move occurs because s has type `std::string::String`, which does not implement the `Copy` trait + +error[E0509]: cannot move out of type `D`, which implements the `Drop` trait + --> $DIR/move-errors.rs:96:11 + | +LL | match x { + | ^ cannot move out of here +... +LL | B::U(D(s)) => (), + | - help: to prevent move, use ref or ref mut: `ref s` + +error[E0509]: cannot move out of type `D`, which implements the `Drop` trait + --> $DIR/move-errors.rs:105:11 + | +LL | match x { + | ^ cannot move out of here +... +LL | (D(s), &t) => (), + | - help: to prevent move, use ref or ref mut: `ref s` + +error[E0507]: cannot move out of borrowed content + --> $DIR/move-errors.rs:105:11 + | +LL | match x { + | ^ cannot move out of borrowed content +... +LL | (D(s), &t) => (), + | - help: to prevent move, use ref or ref mut: `ref t` + +error[E0509]: cannot move out of type `F`, which implements the `Drop` trait + --> $DIR/move-errors.rs:115:11 + | +LL | match x { + | ^ cannot move out of here +help: to prevent move, use ref or ref mut + | +LL | F(ref s, mut t) => (), + | ^^^^^ +help: to prevent move, use ref or ref mut + | +LL | F(s, ref mut t) => (), + | ^^^^^^^^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/move-errors.rs:123:11 + | +LL | match *x { + | ^^ + | | + | cannot move out of borrowed content + | help: consider removing this dereference operator: `x` +LL | //~^ ERROR +LL | Ok(s) | Err(s) => (), + | - move occurs because s has type `std::string::String`, which does not implement the `Copy` trait + +error: aborting due to 14 previous errors + +Some errors occurred: E0507, E0508, E0509. +For more information about an error, try `rustc --explain E0507`. |
