Split tests more and bless them again
This commit is contained in:
parent
f335fb08c2
commit
0023dd9ba1
5 changed files with 653 additions and 602 deletions
|
@ -0,0 +1,162 @@
|
|||
// 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.
|
||||
|
||||
#![feature(nll)]
|
||||
|
||||
#[derive(Clone)]
|
||||
enum Either {
|
||||
One(X),
|
||||
Two(X),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct X(Y);
|
||||
|
||||
#[derive(Clone)]
|
||||
struct Y;
|
||||
|
||||
|
||||
pub fn main() {
|
||||
let e = Either::One(X(Y));
|
||||
let mut em = Either::One(X(Y));
|
||||
|
||||
let r = &e;
|
||||
let rm = &mut Either::One(X(Y));
|
||||
|
||||
let x = X(Y);
|
||||
let mut xm = X(Y);
|
||||
|
||||
let s = &x;
|
||||
let sm = &mut X(Y);
|
||||
|
||||
let ve = vec![Either::One(X(Y))];
|
||||
|
||||
let vr = &ve;
|
||||
let vrm = &mut vec![Either::One(X(Y))];
|
||||
|
||||
let vx = vec![X(Y)];
|
||||
|
||||
let vs = &vx;
|
||||
let vsm = &mut vec![X(Y)];
|
||||
|
||||
// -------- test for duplicate suggestions --------
|
||||
|
||||
let &(X(_t), X(_u)) = &(x.clone(), x.clone());
|
||||
//~^ ERROR cannot move
|
||||
//~| HELP consider removing the `&`
|
||||
//~| SUGGESTION (X(_t), X(_u))
|
||||
if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { }
|
||||
//~^ ERROR cannot move
|
||||
//~| HELP consider removing the `&`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { }
|
||||
//~^ ERROR cannot move
|
||||
//~| HELP consider removing the `&`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
match &(e.clone(), e.clone()) {
|
||||
//~^ ERROR cannot move
|
||||
&(Either::One(_t), Either::Two(_u)) => (),
|
||||
//~^ HELP consider removing the `&`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
&(Either::Two(_t), Either::One(_u)) => (),
|
||||
//~^ HELP consider removing the `&`
|
||||
//~| SUGGESTION (Either::Two(_t), Either::One(_u))
|
||||
_ => (),
|
||||
}
|
||||
match &(e.clone(), e.clone()) {
|
||||
//~^ ERROR cannot move
|
||||
&(Either::One(_t), Either::Two(_u))
|
||||
//~^ HELP consider removing the `&`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
| &(Either::Two(_t), Either::One(_u)) => (),
|
||||
// FIXME: would really like a suggestion here too
|
||||
_ => (),
|
||||
}
|
||||
match &(e.clone(), e.clone()) {
|
||||
//~^ ERROR cannot move
|
||||
&(Either::One(_t), Either::Two(_u)) => (),
|
||||
//~^ HELP consider removing the `&`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
&(Either::Two(ref _t), Either::One(ref _u)) => (),
|
||||
_ => (),
|
||||
}
|
||||
match &(e.clone(), e.clone()) {
|
||||
//~^ ERROR cannot move
|
||||
&(Either::One(_t), Either::Two(_u)) => (),
|
||||
//~^ HELP consider removing the `&`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
(Either::Two(_t), Either::One(_u)) => (),
|
||||
_ => (),
|
||||
}
|
||||
fn f5(&(X(_t), X(_u)): &(X, X)) { }
|
||||
//~^ ERROR cannot move
|
||||
//~| HELP consider removing the `&`
|
||||
//~| SUGGESTION (X(_t), X(_u))
|
||||
|
||||
let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone());
|
||||
//~^ ERROR cannot move
|
||||
//~| HELP consider removing the `&mut`
|
||||
//~| SUGGESTION (X(_t), X(_u))
|
||||
if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
|
||||
//~^ ERROR cannot move
|
||||
//~| HELP consider removing the `&mut`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
|
||||
//~^ ERROR cannot move
|
||||
//~| HELP consider removing the `&mut`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
match &mut (em.clone(), em.clone()) {
|
||||
//~^ ERROR cannot move
|
||||
&mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
//~^ HELP consider removing the `&mut`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
&mut (Either::Two(_t), Either::One(_u)) => (),
|
||||
//~^ HELP consider removing the `&mut`
|
||||
//~| SUGGESTION (Either::Two(_t), Either::One(_u))
|
||||
_ => (),
|
||||
}
|
||||
match &mut (em.clone(), em.clone()) {
|
||||
//~^ ERROR cannot move
|
||||
&mut (Either::One(_t), Either::Two(_u))
|
||||
//~^ HELP consider removing the `&mut`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
| &mut (Either::Two(_t), Either::One(_u)) => (),
|
||||
// FIXME: would really like a suggestion here too
|
||||
_ => (),
|
||||
}
|
||||
match &mut (em.clone(), em.clone()) {
|
||||
//~^ ERROR cannot move
|
||||
&mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
//~^ HELP consider removing the `&mut`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
&mut (Either::Two(ref _t), Either::One(ref _u)) => (),
|
||||
_ => (),
|
||||
}
|
||||
match &mut (em.clone(), em.clone()) {
|
||||
//~^ ERROR cannot move
|
||||
&mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
//~^ HELP consider removing the `&mut`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
&mut (Either::Two(ref mut _t), Either::One(ref mut _u)) => (),
|
||||
_ => (),
|
||||
}
|
||||
match &mut (em.clone(), em.clone()) {
|
||||
//~^ ERROR cannot move
|
||||
&mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
//~^ HELP consider removing the `&mut`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
(Either::Two(_t), Either::One(_u)) => (),
|
||||
_ => (),
|
||||
}
|
||||
fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { }
|
||||
//~^ ERROR cannot move
|
||||
//~| HELP consider removing the `&mut`
|
||||
//~| SUGGESTION (X(_t), X(_u))
|
||||
}
|
|
@ -0,0 +1,328 @@
|
|||
error[E0507]: cannot move out of borrowed content
|
||||
--> $DIR/duplicate-suggestions.rs:51:27
|
||||
|
|
||||
LL | let &(X(_t), X(_u)) = &(x.clone(), x.clone());
|
||||
| --------------- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
|
||||
| | | |
|
||||
| | | ...and here
|
||||
| | data moved here
|
||||
| help: consider removing the `&`: `(X(_t), X(_u))`
|
||||
|
|
||||
note: move occurs because these variables have types that don't implement the `Copy` trait
|
||||
--> $DIR/duplicate-suggestions.rs:51:13
|
||||
|
|
||||
LL | let &(X(_t), X(_u)) = &(x.clone(), x.clone());
|
||||
| ^^ ^^
|
||||
|
||||
error[E0507]: cannot move out of borrowed content
|
||||
--> $DIR/duplicate-suggestions.rs:55:50
|
||||
|
|
||||
LL | if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { }
|
||||
| ----------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
|
||||
| | | |
|
||||
| | | ...and here
|
||||
| | data moved here
|
||||
| help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))`
|
||||
|
|
||||
note: move occurs because these variables have types that don't implement the `Copy` trait
|
||||
--> $DIR/duplicate-suggestions.rs:55:26
|
||||
|
|
||||
LL | if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { }
|
||||
| ^^ ^^
|
||||
|
||||
error[E0507]: cannot move out of borrowed content
|
||||
--> $DIR/duplicate-suggestions.rs:59:53
|
||||
|
|
||||
LL | while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { }
|
||||
| ----------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
|
||||
| | | |
|
||||
| | | ...and here
|
||||
| | data moved here
|
||||
| help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))`
|
||||
|
|
||||
note: move occurs because these variables have types that don't implement the `Copy` trait
|
||||
--> $DIR/duplicate-suggestions.rs:59:29
|
||||
|
|
||||
LL | while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { }
|
||||
| ^^ ^^
|
||||
|
||||
error[E0507]: cannot move out of borrowed content
|
||||
--> $DIR/duplicate-suggestions.rs:63:11
|
||||
|
|
||||
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
|
||||
| |
|
||||
| data moved here
|
||||
...
|
||||
LL | &(Either::Two(_t), Either::One(_u)) => (),
|
||||
| -- ...and here -- ...and here
|
||||
|
|
||||
note: move occurs because these variables have types that don't implement the `Copy` trait
|
||||
--> $DIR/duplicate-suggestions.rs:65:23
|
||||
|
|
||||
LL | &(Either::One(_t), Either::Two(_u)) => (),
|
||||
| ^^ ^^
|
||||
...
|
||||
LL | &(Either::Two(_t), Either::One(_u)) => (),
|
||||
| ^^ ^^
|
||||
help: consider removing the `&`
|
||||
|
|
||||
LL | (Either::One(_t), Either::Two(_u)) => (),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: consider removing the `&`
|
||||
|
|
||||
LL | (Either::Two(_t), Either::One(_u)) => (),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0507]: cannot move out of borrowed content
|
||||
--> $DIR/duplicate-suggestions.rs:73:11
|
||||
|
|
||||
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
|
||||
| | data moved here
|
||||
| help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))`
|
||||
|
|
||||
note: move occurs because these variables have types that don't implement the `Copy` trait
|
||||
--> $DIR/duplicate-suggestions.rs:75:23
|
||||
|
|
||||
LL | &(Either::One(_t), Either::Two(_u))
|
||||
| ^^ ^^
|
||||
|
||||
error[E0507]: cannot move out of borrowed content
|
||||
--> $DIR/duplicate-suggestions.rs:82:11
|
||||
|
|
||||
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
|
||||
| | data moved here
|
||||
| help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))`
|
||||
|
|
||||
note: move occurs because these variables have types that don't implement the `Copy` trait
|
||||
--> $DIR/duplicate-suggestions.rs:84:23
|
||||
|
|
||||
LL | &(Either::One(_t), Either::Two(_u)) => (),
|
||||
| ^^ ^^
|
||||
|
||||
error[E0507]: cannot move out of borrowed content
|
||||
--> $DIR/duplicate-suggestions.rs:90:11
|
||||
|
|
||||
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
|
||||
| | data moved here
|
||||
| help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))`
|
||||
|
|
||||
note: move occurs because these variables have types that don't implement the `Copy` trait
|
||||
--> $DIR/duplicate-suggestions.rs:92:23
|
||||
|
|
||||
LL | &(Either::One(_t), Either::Two(_u)) => (),
|
||||
| ^^ ^^
|
||||
|
||||
error[E0507]: cannot move out of borrowed content
|
||||
--> $DIR/duplicate-suggestions.rs:103:31
|
||||
|
|
||||
LL | let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone());
|
||||
| ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
|
||||
| | | |
|
||||
| | | ...and here
|
||||
| | data moved here
|
||||
| help: consider removing the `&mut`: `(X(_t), X(_u))`
|
||||
|
|
||||
note: move occurs because these variables have types that don't implement the `Copy` trait
|
||||
--> $DIR/duplicate-suggestions.rs:103:17
|
||||
|
|
||||
LL | let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone());
|
||||
| ^^ ^^
|
||||
|
||||
error[E0507]: cannot move out of borrowed content
|
||||
--> $DIR/duplicate-suggestions.rs:107:54
|
||||
|
|
||||
LL | if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
|
||||
| --------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
|
||||
| | | |
|
||||
| | | ...and here
|
||||
| | data moved here
|
||||
| help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))`
|
||||
|
|
||||
note: move occurs because these variables have types that don't implement the `Copy` trait
|
||||
--> $DIR/duplicate-suggestions.rs:107:30
|
||||
|
|
||||
LL | if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
|
||||
| ^^ ^^
|
||||
|
||||
error[E0507]: cannot move out of borrowed content
|
||||
--> $DIR/duplicate-suggestions.rs:111:57
|
||||
|
|
||||
LL | while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
|
||||
| --------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
|
||||
| | | |
|
||||
| | | ...and here
|
||||
| | data moved here
|
||||
| help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))`
|
||||
|
|
||||
note: move occurs because these variables have types that don't implement the `Copy` trait
|
||||
--> $DIR/duplicate-suggestions.rs:111:33
|
||||
|
|
||||
LL | while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
|
||||
| ^^ ^^
|
||||
|
||||
error[E0507]: cannot move out of borrowed content
|
||||
--> $DIR/duplicate-suggestions.rs:115:11
|
||||
|
|
||||
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
|
||||
| |
|
||||
| data moved here
|
||||
...
|
||||
LL | &mut (Either::Two(_t), Either::One(_u)) => (),
|
||||
| -- ...and here -- ...and here
|
||||
|
|
||||
note: move occurs because these variables have types that don't implement the `Copy` trait
|
||||
--> $DIR/duplicate-suggestions.rs:117:27
|
||||
|
|
||||
LL | &mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
| ^^ ^^
|
||||
...
|
||||
LL | &mut (Either::Two(_t), Either::One(_u)) => (),
|
||||
| ^^ ^^
|
||||
help: consider removing the `&mut`
|
||||
|
|
||||
LL | (Either::One(_t), Either::Two(_u)) => (),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: consider removing the `&mut`
|
||||
|
|
||||
LL | (Either::Two(_t), Either::One(_u)) => (),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0507]: cannot move out of borrowed content
|
||||
--> $DIR/duplicate-suggestions.rs:125:11
|
||||
|
|
||||
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
|
||||
| | data moved here
|
||||
| help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))`
|
||||
|
|
||||
note: move occurs because these variables have types that don't implement the `Copy` trait
|
||||
--> $DIR/duplicate-suggestions.rs:127:27
|
||||
|
|
||||
LL | &mut (Either::One(_t), Either::Two(_u))
|
||||
| ^^ ^^
|
||||
|
||||
error[E0507]: cannot move out of borrowed content
|
||||
--> $DIR/duplicate-suggestions.rs:134:11
|
||||
|
|
||||
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
|
||||
| | data moved here
|
||||
| help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))`
|
||||
|
|
||||
note: move occurs because these variables have types that don't implement the `Copy` trait
|
||||
--> $DIR/duplicate-suggestions.rs:136:27
|
||||
|
|
||||
LL | &mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
| ^^ ^^
|
||||
|
||||
error[E0507]: cannot move out of borrowed content
|
||||
--> $DIR/duplicate-suggestions.rs:142:11
|
||||
|
|
||||
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
|
||||
| | data moved here
|
||||
| help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))`
|
||||
|
|
||||
note: move occurs because these variables have types that don't implement the `Copy` trait
|
||||
--> $DIR/duplicate-suggestions.rs:144:27
|
||||
|
|
||||
LL | &mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
| ^^ ^^
|
||||
|
||||
error[E0507]: cannot move out of borrowed content
|
||||
--> $DIR/duplicate-suggestions.rs:150:11
|
||||
|
|
||||
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
|
||||
| | data moved here
|
||||
| help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))`
|
||||
|
|
||||
note: move occurs because these variables have types that don't implement the `Copy` trait
|
||||
--> $DIR/duplicate-suggestions.rs:152:27
|
||||
|
|
||||
LL | &mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
| ^^ ^^
|
||||
|
||||
error[E0507]: cannot move out of borrowed content
|
||||
--> $DIR/duplicate-suggestions.rs:98:11
|
||||
|
|
||||
LL | fn f5(&(X(_t), X(_u)): &(X, X)) { }
|
||||
| ^^^^--^^^^^--^^
|
||||
| | | |
|
||||
| | | ...and here
|
||||
| | data moved here
|
||||
| cannot move out of borrowed content
|
||||
| help: consider removing the `&`: `(X(_t), X(_u))`
|
||||
|
|
||||
note: move occurs because these variables have types that don't implement the `Copy` trait
|
||||
--> $DIR/duplicate-suggestions.rs:98:15
|
||||
|
|
||||
LL | fn f5(&(X(_t), X(_u)): &(X, X)) { }
|
||||
| ^^ ^^
|
||||
|
||||
error[E0507]: cannot move out of borrowed content
|
||||
--> $DIR/duplicate-suggestions.rs:158:11
|
||||
|
|
||||
LL | fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { }
|
||||
| ^^^^^^^^--^^^^^--^^
|
||||
| | | |
|
||||
| | | ...and here
|
||||
| | data moved here
|
||||
| cannot move out of borrowed content
|
||||
| help: consider removing the `&mut`: `(X(_t), X(_u))`
|
||||
|
|
||||
note: move occurs because these variables have types that don't implement the `Copy` trait
|
||||
--> $DIR/duplicate-suggestions.rs:158:19
|
||||
|
|
||||
LL | fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { }
|
||||
| ^^ ^^
|
||||
|
||||
error: aborting due to 17 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0507`.
|
|
@ -1,5 +1,5 @@
|
|||
error[E0507]: cannot move out of captured variable in an `Fn` closure
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:40:21
|
||||
--> $DIR/move-into-closure.rs:40:21
|
||||
|
|
||||
LL | let x = X(Y);
|
||||
| - captured outer variable
|
||||
|
@ -12,13 +12,13 @@ LL | let X(_t) = x;
|
|||
| data moved here
|
||||
|
|
||||
note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:40:15
|
||||
--> $DIR/move-into-closure.rs:40:15
|
||||
|
|
||||
LL | let X(_t) = x;
|
||||
| ^^
|
||||
|
||||
error[E0507]: cannot move out of captured variable in an `Fn` closure
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:44:34
|
||||
--> $DIR/move-into-closure.rs:44:34
|
||||
|
|
||||
LL | let e = Either::One(X(Y));
|
||||
| - captured outer variable
|
||||
|
@ -31,13 +31,13 @@ LL | if let Either::One(_t) = e { }
|
|||
| data moved here
|
||||
|
|
||||
note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:44:28
|
||||
--> $DIR/move-into-closure.rs:44:28
|
||||
|
|
||||
LL | if let Either::One(_t) = e { }
|
||||
| ^^
|
||||
|
||||
error[E0507]: cannot move out of captured variable in an `Fn` closure
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:48:37
|
||||
--> $DIR/move-into-closure.rs:48:37
|
||||
|
|
||||
LL | let e = Either::One(X(Y));
|
||||
| - captured outer variable
|
||||
|
@ -50,13 +50,13 @@ LL | while let Either::One(_t) = e { }
|
|||
| data moved here
|
||||
|
|
||||
note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:48:31
|
||||
--> $DIR/move-into-closure.rs:48:31
|
||||
|
|
||||
LL | while let Either::One(_t) = e { }
|
||||
| ^^
|
||||
|
||||
error[E0507]: cannot move out of captured variable in an `Fn` closure
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:52:15
|
||||
--> $DIR/move-into-closure.rs:52:15
|
||||
|
|
||||
LL | let e = Either::One(X(Y));
|
||||
| - captured outer variable
|
||||
|
@ -71,13 +71,13 @@ LL | Either::One(_t)
|
|||
| -- data moved here
|
||||
|
|
||||
note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:56:25
|
||||
--> $DIR/move-into-closure.rs:56:25
|
||||
|
|
||||
LL | Either::One(_t)
|
||||
| ^^
|
||||
|
||||
error[E0507]: cannot move out of captured variable in an `Fn` closure
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:59:15
|
||||
--> $DIR/move-into-closure.rs:59:15
|
||||
|
|
||||
LL | let e = Either::One(X(Y));
|
||||
| - captured outer variable
|
||||
|
@ -92,13 +92,13 @@ LL | Either::One(_t) => (),
|
|||
| -- data moved here
|
||||
|
|
||||
note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:63:25
|
||||
--> $DIR/move-into-closure.rs:63:25
|
||||
|
|
||||
LL | Either::One(_t) => (),
|
||||
| ^^
|
||||
|
||||
error[E0507]: cannot move out of captured variable in an `Fn` closure
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:68:25
|
||||
--> $DIR/move-into-closure.rs:68:25
|
||||
|
|
||||
LL | let x = X(Y);
|
||||
| - captured outer variable
|
||||
|
@ -111,13 +111,13 @@ LL | let X(mut _t) = x;
|
|||
| data moved here
|
||||
|
|
||||
note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:68:15
|
||||
--> $DIR/move-into-closure.rs:68:15
|
||||
|
|
||||
LL | let X(mut _t) = x;
|
||||
| ^^^^^^
|
||||
|
||||
error[E0507]: cannot move out of captured variable in an `Fn` closure
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:72:38
|
||||
--> $DIR/move-into-closure.rs:72:38
|
||||
|
|
||||
LL | let mut em = Either::One(X(Y));
|
||||
| ------ captured outer variable
|
||||
|
@ -130,13 +130,13 @@ LL | if let Either::One(mut _t) = em { }
|
|||
| data moved here
|
||||
|
|
||||
note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:72:28
|
||||
--> $DIR/move-into-closure.rs:72:28
|
||||
|
|
||||
LL | if let Either::One(mut _t) = em { }
|
||||
| ^^^^^^
|
||||
|
||||
error[E0507]: cannot move out of captured variable in an `Fn` closure
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:76:41
|
||||
--> $DIR/move-into-closure.rs:76:41
|
||||
|
|
||||
LL | let mut em = Either::One(X(Y));
|
||||
| ------ captured outer variable
|
||||
|
@ -149,13 +149,13 @@ LL | while let Either::One(mut _t) = em { }
|
|||
| data moved here
|
||||
|
|
||||
note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:76:31
|
||||
--> $DIR/move-into-closure.rs:76:31
|
||||
|
|
||||
LL | while let Either::One(mut _t) = em { }
|
||||
| ^^^^^^
|
||||
|
||||
error[E0507]: cannot move out of captured variable in an `Fn` closure
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:80:15
|
||||
--> $DIR/move-into-closure.rs:80:15
|
||||
|
|
||||
LL | let mut em = Either::One(X(Y));
|
||||
| ------ captured outer variable
|
||||
|
@ -170,13 +170,13 @@ LL | Either::One(mut _t)
|
|||
| ------ data moved here
|
||||
|
|
||||
note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:84:25
|
||||
--> $DIR/move-into-closure.rs:84:25
|
||||
|
|
||||
LL | Either::One(mut _t)
|
||||
| ^^^^^^
|
||||
|
||||
error[E0507]: cannot move out of captured variable in an `Fn` closure
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:87:15
|
||||
--> $DIR/move-into-closure.rs:87:15
|
||||
|
|
||||
LL | let mut em = Either::One(X(Y));
|
||||
| ------ captured outer variable
|
||||
|
@ -191,13 +191,13 @@ LL | Either::One(mut _t) => (),
|
|||
| ------ data moved here
|
||||
|
|
||||
note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:91:25
|
||||
--> $DIR/move-into-closure.rs:91:25
|
||||
|
|
||||
LL | Either::One(mut _t) => (),
|
||||
| ^^^^^^
|
||||
|
||||
error[E0507]: cannot move out of captured variable in an `FnMut` closure
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:107:21
|
||||
--> $DIR/move-into-closure.rs:107:21
|
||||
|
|
||||
LL | let x = X(Y);
|
||||
| - captured outer variable
|
||||
|
@ -210,13 +210,13 @@ LL | let X(_t) = x;
|
|||
| data moved here
|
||||
|
|
||||
note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:107:15
|
||||
--> $DIR/move-into-closure.rs:107:15
|
||||
|
|
||||
LL | let X(_t) = x;
|
||||
| ^^
|
||||
|
||||
error[E0507]: cannot move out of captured variable in an `FnMut` closure
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:111:34
|
||||
--> $DIR/move-into-closure.rs:111:34
|
||||
|
|
||||
LL | let e = Either::One(X(Y));
|
||||
| - captured outer variable
|
||||
|
@ -229,13 +229,13 @@ LL | if let Either::One(_t) = e { }
|
|||
| data moved here
|
||||
|
|
||||
note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:111:28
|
||||
--> $DIR/move-into-closure.rs:111:28
|
||||
|
|
||||
LL | if let Either::One(_t) = e { }
|
||||
| ^^
|
||||
|
||||
error[E0507]: cannot move out of captured variable in an `FnMut` closure
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:115:37
|
||||
--> $DIR/move-into-closure.rs:115:37
|
||||
|
|
||||
LL | let e = Either::One(X(Y));
|
||||
| - captured outer variable
|
||||
|
@ -248,13 +248,13 @@ LL | while let Either::One(_t) = e { }
|
|||
| data moved here
|
||||
|
|
||||
note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:115:31
|
||||
--> $DIR/move-into-closure.rs:115:31
|
||||
|
|
||||
LL | while let Either::One(_t) = e { }
|
||||
| ^^
|
||||
|
||||
error[E0507]: cannot move out of captured variable in an `FnMut` closure
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:119:15
|
||||
--> $DIR/move-into-closure.rs:119:15
|
||||
|
|
||||
LL | let e = Either::One(X(Y));
|
||||
| - captured outer variable
|
||||
|
@ -269,13 +269,13 @@ LL | Either::One(_t)
|
|||
| -- data moved here
|
||||
|
|
||||
note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:123:25
|
||||
--> $DIR/move-into-closure.rs:123:25
|
||||
|
|
||||
LL | Either::One(_t)
|
||||
| ^^
|
||||
|
||||
error[E0507]: cannot move out of captured variable in an `FnMut` closure
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:126:15
|
||||
--> $DIR/move-into-closure.rs:126:15
|
||||
|
|
||||
LL | let e = Either::One(X(Y));
|
||||
| - captured outer variable
|
||||
|
@ -290,13 +290,13 @@ LL | Either::One(_t) => (),
|
|||
| -- data moved here
|
||||
|
|
||||
note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:130:25
|
||||
--> $DIR/move-into-closure.rs:130:25
|
||||
|
|
||||
LL | Either::One(_t) => (),
|
||||
| ^^
|
||||
|
||||
error[E0507]: cannot move out of captured variable in an `FnMut` closure
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:135:25
|
||||
--> $DIR/move-into-closure.rs:135:25
|
||||
|
|
||||
LL | let x = X(Y);
|
||||
| - captured outer variable
|
||||
|
@ -309,13 +309,13 @@ LL | let X(mut _t) = x;
|
|||
| data moved here
|
||||
|
|
||||
note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:135:15
|
||||
--> $DIR/move-into-closure.rs:135:15
|
||||
|
|
||||
LL | let X(mut _t) = x;
|
||||
| ^^^^^^
|
||||
|
||||
error[E0507]: cannot move out of captured variable in an `FnMut` closure
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:139:38
|
||||
--> $DIR/move-into-closure.rs:139:38
|
||||
|
|
||||
LL | let mut em = Either::One(X(Y));
|
||||
| ------ captured outer variable
|
||||
|
@ -328,13 +328,13 @@ LL | if let Either::One(mut _t) = em { }
|
|||
| data moved here
|
||||
|
|
||||
note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:139:28
|
||||
--> $DIR/move-into-closure.rs:139:28
|
||||
|
|
||||
LL | if let Either::One(mut _t) = em { }
|
||||
| ^^^^^^
|
||||
|
||||
error[E0507]: cannot move out of captured variable in an `FnMut` closure
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:143:41
|
||||
--> $DIR/move-into-closure.rs:143:41
|
||||
|
|
||||
LL | let mut em = Either::One(X(Y));
|
||||
| ------ captured outer variable
|
||||
|
@ -347,13 +347,13 @@ LL | while let Either::One(mut _t) = em { }
|
|||
| data moved here
|
||||
|
|
||||
note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:143:31
|
||||
--> $DIR/move-into-closure.rs:143:31
|
||||
|
|
||||
LL | while let Either::One(mut _t) = em { }
|
||||
| ^^^^^^
|
||||
|
||||
error[E0507]: cannot move out of captured variable in an `FnMut` closure
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:147:15
|
||||
--> $DIR/move-into-closure.rs:147:15
|
||||
|
|
||||
LL | let mut em = Either::One(X(Y));
|
||||
| ------ captured outer variable
|
||||
|
@ -368,13 +368,13 @@ LL | Either::One(mut _t)
|
|||
| ------ data moved here
|
||||
|
|
||||
note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:151:25
|
||||
--> $DIR/move-into-closure.rs:151:25
|
||||
|
|
||||
LL | Either::One(mut _t)
|
||||
| ^^^^^^
|
||||
|
||||
error[E0507]: cannot move out of captured variable in an `FnMut` closure
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:154:15
|
||||
--> $DIR/move-into-closure.rs:154:15
|
||||
|
|
||||
LL | let mut em = Either::One(X(Y));
|
||||
| ------ captured outer variable
|
||||
|
@ -389,13 +389,13 @@ LL | Either::One(mut _t) => (),
|
|||
| ------ data moved here
|
||||
|
|
||||
note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:158:25
|
||||
--> $DIR/move-into-closure.rs:158:25
|
||||
|
|
||||
LL | Either::One(mut _t) => (),
|
||||
| ^^^^^^
|
||||
|
||||
error[E0507]: cannot move out of captured variable in an `FnMut` closure
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:162:15
|
||||
--> $DIR/move-into-closure.rs:162:15
|
||||
|
|
||||
LL | let mut em = Either::One(X(Y));
|
||||
| ------ captured outer variable
|
||||
|
@ -410,7 +410,7 @@ LL | Either::One(mut _t) => (),
|
|||
| ------ data moved here
|
||||
|
|
||||
note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
|
||||
--> $DIR/dont-suggest-ref-in-closure.rs:166:25
|
||||
--> $DIR/move-into-closure.rs:166:25
|
||||
|
|
||||
LL | Either::One(mut _t) => (),
|
||||
| ^^^^^^
|
||||
|
|
|
@ -373,118 +373,4 @@ pub fn main() {
|
|||
//~| SUGGESTION Either::One(_t)
|
||||
Either::Two(_t) => (),
|
||||
}
|
||||
|
||||
// -------- test for duplicate suggestions --------
|
||||
|
||||
let &(X(_t), X(_u)) = &(x.clone(), x.clone());
|
||||
//~^ ERROR cannot move
|
||||
//~| HELP consider removing the `&`
|
||||
//~| SUGGESTION (X(_t), X(_u))
|
||||
if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { }
|
||||
//~^ ERROR cannot move
|
||||
//~| HELP consider removing the `&`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { }
|
||||
//~^ ERROR cannot move
|
||||
//~| HELP consider removing the `&`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
match &(e.clone(), e.clone()) {
|
||||
//~^ ERROR cannot move
|
||||
&(Either::One(_t), Either::Two(_u)) => (),
|
||||
//~^ HELP consider removing the `&`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
&(Either::Two(_t), Either::One(_u)) => (),
|
||||
//~^ HELP consider removing the `&`
|
||||
//~| SUGGESTION (Either::Two(_t), Either::One(_u))
|
||||
_ => (),
|
||||
}
|
||||
match &(e.clone(), e.clone()) {
|
||||
//~^ ERROR cannot move
|
||||
&(Either::One(_t), Either::Two(_u))
|
||||
//~^ HELP consider removing the `&`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
| &(Either::Two(_t), Either::One(_u)) => (),
|
||||
// FIXME: would really like a suggestion here too
|
||||
_ => (),
|
||||
}
|
||||
match &(e.clone(), e.clone()) {
|
||||
//~^ ERROR cannot move
|
||||
&(Either::One(_t), Either::Two(_u)) => (),
|
||||
//~^ HELP consider removing the `&`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
&(Either::Two(ref _t), Either::One(ref _u)) => (),
|
||||
_ => (),
|
||||
}
|
||||
match &(e.clone(), e.clone()) {
|
||||
//~^ ERROR cannot move
|
||||
&(Either::One(_t), Either::Two(_u)) => (),
|
||||
//~^ HELP consider removing the `&`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
(Either::Two(_t), Either::One(_u)) => (),
|
||||
_ => (),
|
||||
}
|
||||
fn f5(&(X(_t), X(_u)): &(X, X)) { }
|
||||
//~^ ERROR cannot move
|
||||
//~| HELP consider removing the `&`
|
||||
//~| SUGGESTION (X(_t), X(_u))
|
||||
|
||||
let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone());
|
||||
//~^ ERROR cannot move
|
||||
//~| HELP consider removing the `&mut`
|
||||
//~| SUGGESTION (X(_t), X(_u))
|
||||
if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
|
||||
//~^ ERROR cannot move
|
||||
//~| HELP consider removing the `&mut`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
|
||||
//~^ ERROR cannot move
|
||||
//~| HELP consider removing the `&mut`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
match &mut (em.clone(), em.clone()) {
|
||||
//~^ ERROR cannot move
|
||||
&mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
//~^ HELP consider removing the `&mut`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
&mut (Either::Two(_t), Either::One(_u)) => (),
|
||||
//~^ HELP consider removing the `&mut`
|
||||
//~| SUGGESTION (Either::Two(_t), Either::One(_u))
|
||||
_ => (),
|
||||
}
|
||||
match &mut (em.clone(), em.clone()) {
|
||||
//~^ ERROR cannot move
|
||||
&mut (Either::One(_t), Either::Two(_u))
|
||||
//~^ HELP consider removing the `&mut`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
| &mut (Either::Two(_t), Either::One(_u)) => (),
|
||||
// FIXME: would really like a suggestion here too
|
||||
_ => (),
|
||||
}
|
||||
match &mut (em.clone(), em.clone()) {
|
||||
//~^ ERROR cannot move
|
||||
&mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
//~^ HELP consider removing the `&mut`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
&mut (Either::Two(ref _t), Either::One(ref _u)) => (),
|
||||
_ => (),
|
||||
}
|
||||
match &mut (em.clone(), em.clone()) {
|
||||
//~^ ERROR cannot move
|
||||
&mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
//~^ HELP consider removing the `&mut`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
&mut (Either::Two(ref mut _t), Either::One(ref mut _u)) => (),
|
||||
_ => (),
|
||||
}
|
||||
match &mut (em.clone(), em.clone()) {
|
||||
//~^ ERROR cannot move
|
||||
&mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
//~^ HELP consider removing the `&mut`
|
||||
//~| SUGGESTION (Either::One(_t), Either::Two(_u))
|
||||
(Either::Two(_t), Either::One(_u)) => (),
|
||||
_ => (),
|
||||
}
|
||||
fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { }
|
||||
//~^ ERROR cannot move
|
||||
//~| HELP consider removing the `&mut`
|
||||
//~| SUGGESTION (X(_t), X(_u))
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue