Update tests for grouped nll move errors
This commit is contained in:
parent
0193d1f736
commit
2cb0a0631a
16 changed files with 378 additions and 104 deletions
|
@ -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]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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`.
|
|
@ -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`.
|
|
@ -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]
|
||||
}
|
||||
|
|
|
@ -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
|
|
@ -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 | g: _t
|
||||
| ^^ cannot move out of here
|
||||
LL | f: ref _s,
|
||||
| ^^^^^^
|
||||
help: to prevent move, use ref or ref mut
|
||||
|
|
||||
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`.
|
||||
|
|
|
@ -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: b }] => {
|
||||
| ^ cannot move out of here
|
||||
LL | &[Foo { string: ref a },
|
||||
| ^^^^^
|
||||
help: to prevent move, use ref or ref mut
|
||||
|
|
||||
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`.
|
||||
|
|
|
@ -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, _b, _c] => {} //~ ERROR cannot move out
|
||||
| ^^ cannot move out of here
|
||||
LL | &mut [_a, ref _b, _c] => {} //~ ERROR cannot move out
|
||||
| ^^^^^^
|
||||
help: to prevent move, use ref or ref mut
|
||||
|
|
||||
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`.
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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`.
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
130
src/test/ui/nll/move-errors.rs
Normal file
130
src/test/ui/nll/move-errors.rs
Normal file
|
@ -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() {
|
||||
}
|
140
src/test/ui/nll/move-errors.stderr
Normal file
140
src/test/ui/nll/move-errors.stderr
Normal file
|
@ -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`.
|
Loading…
Add table
Reference in a new issue