From f335fb08c2b98df6afd242eb2fc428679a15bbf3 Mon Sep 17 00:00:00 2001 From: ashtneoi Date: Wed, 15 Aug 2018 22:35:56 -0700 Subject: Move tests into their own directory --- .../ui/suggestions/dont-suggest-ref-in-closure.rs | 171 --- .../suggestions/dont-suggest-ref-in-closure.stderr | 420 ------- src/test/ui/suggestions/dont-suggest-ref.rs | 490 -------- src/test/ui/suggestions/dont-suggest-ref.stderr | 1323 -------------------- .../dont-suggest-ref/move-into-closure.rs | 171 +++ .../dont-suggest-ref/move-into-closure.stderr | 420 +++++++ src/test/ui/suggestions/dont-suggest-ref/simple.rs | 490 ++++++++ .../ui/suggestions/dont-suggest-ref/simple.stderr | 1323 ++++++++++++++++++++ 8 files changed, 2404 insertions(+), 2404 deletions(-) delete mode 100644 src/test/ui/suggestions/dont-suggest-ref-in-closure.rs delete mode 100644 src/test/ui/suggestions/dont-suggest-ref-in-closure.stderr delete mode 100644 src/test/ui/suggestions/dont-suggest-ref.rs delete mode 100644 src/test/ui/suggestions/dont-suggest-ref.stderr create mode 100644 src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs create mode 100644 src/test/ui/suggestions/dont-suggest-ref/move-into-closure.stderr create mode 100644 src/test/ui/suggestions/dont-suggest-ref/simple.rs create mode 100644 src/test/ui/suggestions/dont-suggest-ref/simple.stderr (limited to 'src') diff --git a/src/test/ui/suggestions/dont-suggest-ref-in-closure.rs b/src/test/ui/suggestions/dont-suggest-ref-in-closure.rs deleted file mode 100644 index 8cc847e693f..00000000000 --- a/src/test/ui/suggestions/dont-suggest-ref-in-closure.rs +++ /dev/null @@ -1,171 +0,0 @@ -// 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 or the MIT license -// , 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; - -fn consume_fn(_f: F) { } - -fn consume_fnmut(_f: F) { } - -pub fn main() { } - -fn move_into_fn() { - let e = Either::One(X(Y)); - let mut em = Either::One(X(Y)); - - let x = X(Y); - - // -------- move into Fn -------- - - consume_fn(|| { - let X(_t) = x; - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &x - if let Either::One(_t) = e { } - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &e - while let Either::One(_t) = e { } - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &e - match e { - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &e - Either::One(_t) - | Either::Two(_t) => (), - } - match e { - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &e - Either::One(_t) => (), - Either::Two(ref _t) => (), - // FIXME: should suggest removing `ref` too - } - - let X(mut _t) = x; - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &x - if let Either::One(mut _t) = em { } - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &em - while let Either::One(mut _t) = em { } - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &em - match em { - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &em - Either::One(mut _t) - | Either::Two(mut _t) => (), - } - match em { - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &em - Either::One(mut _t) => (), - Either::Two(ref _t) => (), - // FIXME: should suggest removing `ref` too - } - }); -} - -fn move_into_fnmut() { - let e = Either::One(X(Y)); - let mut em = Either::One(X(Y)); - - let x = X(Y); - - // -------- move into FnMut -------- - - consume_fnmut(|| { - let X(_t) = x; - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &x - if let Either::One(_t) = e { } - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &e - while let Either::One(_t) = e { } - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &e - match e { - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &e - Either::One(_t) - | Either::Two(_t) => (), - } - match e { - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &e - Either::One(_t) => (), - Either::Two(ref _t) => (), - // FIXME: should suggest removing `ref` too - } - - let X(mut _t) = x; - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &x - if let Either::One(mut _t) = em { } - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &em - while let Either::One(mut _t) = em { } - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &em - match em { - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &em - Either::One(mut _t) - | Either::Two(mut _t) => (), - } - match em { - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &em - Either::One(mut _t) => (), - Either::Two(ref _t) => (), - // FIXME: should suggest removing `ref` too - } - match em { - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &em - Either::One(mut _t) => (), - Either::Two(ref mut _t) => (), - // FIXME: should suggest removing `ref` too - } - }); -} diff --git a/src/test/ui/suggestions/dont-suggest-ref-in-closure.stderr b/src/test/ui/suggestions/dont-suggest-ref-in-closure.stderr deleted file mode 100644 index 825676b5fdf..00000000000 --- a/src/test/ui/suggestions/dont-suggest-ref-in-closure.stderr +++ /dev/null @@ -1,420 +0,0 @@ -error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/dont-suggest-ref-in-closure.rs:40:21 - | -LL | let x = X(Y); - | - captured outer variable -... -LL | let X(_t) = x; - | -- ^ - | | | - | | cannot move out of captured variable in an `Fn` closure - | | help: consider borrowing here: `&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 - | -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 - | -LL | let e = Either::One(X(Y)); - | - captured outer variable -... -LL | if let Either::One(_t) = e { } - | -- ^ - | | | - | | cannot move out of captured variable in an `Fn` closure - | | help: consider borrowing here: `&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 - | -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 - | -LL | let e = Either::One(X(Y)); - | - captured outer variable -... -LL | while let Either::One(_t) = e { } - | -- ^ - | | | - | | cannot move out of captured variable in an `Fn` closure - | | help: consider borrowing here: `&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 - | -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 - | -LL | let e = Either::One(X(Y)); - | - captured outer variable -... -LL | match e { - | ^ - | | - | cannot move out of captured variable in an `Fn` closure - | help: consider borrowing here: `&e` -... -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 - | -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 - | -LL | let e = Either::One(X(Y)); - | - captured outer variable -... -LL | match e { - | ^ - | | - | cannot move out of captured variable in an `Fn` closure - | help: consider borrowing here: `&e` -... -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 - | -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 - | -LL | let x = X(Y); - | - captured outer variable -... -LL | let X(mut _t) = x; - | ------ ^ - | | | - | | cannot move out of captured variable in an `Fn` closure - | | help: consider borrowing here: `&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 - | -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 - | -LL | let mut em = Either::One(X(Y)); - | ------ captured outer variable -... -LL | if let Either::One(mut _t) = em { } - | ------ ^^ - | | | - | | cannot move out of captured variable in an `Fn` closure - | | help: consider borrowing here: `&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 - | -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 - | -LL | let mut em = Either::One(X(Y)); - | ------ captured outer variable -... -LL | while let Either::One(mut _t) = em { } - | ------ ^^ - | | | - | | cannot move out of captured variable in an `Fn` closure - | | help: consider borrowing here: `&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 - | -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 - | -LL | let mut em = Either::One(X(Y)); - | ------ captured outer variable -... -LL | match em { - | ^^ - | | - | cannot move out of captured variable in an `Fn` closure - | help: consider borrowing here: `&em` -... -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 - | -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 - | -LL | let mut em = Either::One(X(Y)); - | ------ captured outer variable -... -LL | match em { - | ^^ - | | - | cannot move out of captured variable in an `Fn` closure - | help: consider borrowing here: `&em` -... -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 - | -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 - | -LL | let x = X(Y); - | - captured outer variable -... -LL | let X(_t) = x; - | -- ^ - | | | - | | cannot move out of captured variable in an `FnMut` closure - | | help: consider borrowing here: `&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 - | -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 - | -LL | let e = Either::One(X(Y)); - | - captured outer variable -... -LL | if let Either::One(_t) = e { } - | -- ^ - | | | - | | cannot move out of captured variable in an `FnMut` closure - | | help: consider borrowing here: `&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 - | -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 - | -LL | let e = Either::One(X(Y)); - | - captured outer variable -... -LL | while let Either::One(_t) = e { } - | -- ^ - | | | - | | cannot move out of captured variable in an `FnMut` closure - | | help: consider borrowing here: `&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 - | -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 - | -LL | let e = Either::One(X(Y)); - | - captured outer variable -... -LL | match e { - | ^ - | | - | cannot move out of captured variable in an `FnMut` closure - | help: consider borrowing here: `&e` -... -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 - | -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 - | -LL | let e = Either::One(X(Y)); - | - captured outer variable -... -LL | match e { - | ^ - | | - | cannot move out of captured variable in an `FnMut` closure - | help: consider borrowing here: `&e` -... -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 - | -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 - | -LL | let x = X(Y); - | - captured outer variable -... -LL | let X(mut _t) = x; - | ------ ^ - | | | - | | cannot move out of captured variable in an `FnMut` closure - | | help: consider borrowing here: `&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 - | -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 - | -LL | let mut em = Either::One(X(Y)); - | ------ captured outer variable -... -LL | if let Either::One(mut _t) = em { } - | ------ ^^ - | | | - | | cannot move out of captured variable in an `FnMut` closure - | | help: consider borrowing here: `&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 - | -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 - | -LL | let mut em = Either::One(X(Y)); - | ------ captured outer variable -... -LL | while let Either::One(mut _t) = em { } - | ------ ^^ - | | | - | | cannot move out of captured variable in an `FnMut` closure - | | help: consider borrowing here: `&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 - | -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 - | -LL | let mut em = Either::One(X(Y)); - | ------ captured outer variable -... -LL | match em { - | ^^ - | | - | cannot move out of captured variable in an `FnMut` closure - | help: consider borrowing here: `&em` -... -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 - | -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 - | -LL | let mut em = Either::One(X(Y)); - | ------ captured outer variable -... -LL | match em { - | ^^ - | | - | cannot move out of captured variable in an `FnMut` closure - | help: consider borrowing here: `&em` -... -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 - | -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 - | -LL | let mut em = Either::One(X(Y)); - | ------ captured outer variable -... -LL | match em { - | ^^ - | | - | cannot move out of captured variable in an `FnMut` closure - | help: consider borrowing here: `&em` -... -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 - | -LL | Either::One(mut _t) => (), - | ^^^^^^ - -error: aborting due to 21 previous errors - -For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/suggestions/dont-suggest-ref.rs b/src/test/ui/suggestions/dont-suggest-ref.rs deleted file mode 100644 index 3bd6102c5d6..00000000000 --- a/src/test/ui/suggestions/dont-suggest-ref.rs +++ /dev/null @@ -1,490 +0,0 @@ -// 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 or the MIT license -// , 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)]; - - // -------- move from Either/X place -------- - - let X(_t) = *s; - //~^ ERROR cannot move - //~| HELP consider removing the `*` - //~| SUGGESTION s - if let Either::One(_t) = *r { } - //~^ ERROR cannot move - //~| HELP consider removing the `*` - //~| SUGGESTION r - while let Either::One(_t) = *r { } - //~^ ERROR cannot move - //~| HELP consider removing the `*` - //~| SUGGESTION r - match *r { - //~^ ERROR cannot move - //~| HELP consider removing the `*` - //~| SUGGESTION r - Either::One(_t) - | Either::Two(_t) => (), - } - match *r { - //~^ ERROR cannot move - //~| HELP consider removing the `*` - //~| SUGGESTION r - Either::One(_t) => (), - Either::Two(ref _t) => (), - // FIXME: should suggest removing `ref` too - } - - let X(_t) = *sm; - //~^ ERROR cannot move - //~| HELP consider removing the `*` - //~| SUGGESTION sm - if let Either::One(_t) = *rm { } - //~^ ERROR cannot move - //~| HELP consider removing the `*` - //~| SUGGESTION rm - while let Either::One(_t) = *rm { } - //~^ ERROR cannot move - //~| HELP consider removing the `*` - //~| SUGGESTION rm - match *rm { - //~^ ERROR cannot move - //~| HELP consider removing the `*` - //~| SUGGESTION rm - Either::One(_t) - | Either::Two(_t) => (), - } - match *rm { - //~^ ERROR cannot move - //~| HELP consider removing the `*` - //~| SUGGESTION rm - Either::One(_t) => (), - Either::Two(ref _t) => (), - // FIXME: should suggest removing `ref` too - } - match *rm { - //~^ ERROR cannot move - //~| HELP consider removing the `*` - //~| SUGGESTION rm - Either::One(_t) => (), - Either::Two(ref mut _t) => (), - // FIXME: should suggest removing `ref` too - } - - let X(_t) = vs[0]; - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &vs[0] - if let Either::One(_t) = vr[0] { } - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &vr[0] - while let Either::One(_t) = vr[0] { } - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &vr[0] - match vr[0] { - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &vr[0] - Either::One(_t) - | Either::Two(_t) => (), - } - match vr[0] { - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &vr[0] - Either::One(_t) => (), - Either::Two(ref _t) => (), - // FIXME: should suggest removing `ref` too - } - - let X(_t) = vsm[0]; - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &vsm[0] - if let Either::One(_t) = vrm[0] { } - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &vrm[0] - while let Either::One(_t) = vrm[0] { } - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &vrm[0] - match vrm[0] { - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &vrm[0] - Either::One(_t) - | Either::Two(_t) => (), - } - match vrm[0] { - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &vrm[0] - Either::One(_t) => (), - Either::Two(ref _t) => (), - // FIXME: should suggest removing `ref` too - } - match vrm[0] { - //~^ ERROR cannot move - //~| HELP consider borrowing here - //~| SUGGESTION &vrm[0] - Either::One(_t) => (), - Either::Two(ref mut _t) => (), - // FIXME: should suggest removing `ref` too - } - - // -------- move from &Either/&X place -------- - - let &X(_t) = s; - //~^ ERROR cannot move - //~| HELP consider removing the `&` - //~| SUGGESTION X(_t) - if let &Either::One(_t) = r { } - //~^ ERROR cannot move - //~| HELP consider removing the `&` - //~| SUGGESTION Either::One(_t) - while let &Either::One(_t) = r { } - //~^ ERROR cannot move - //~| HELP consider removing the `&` - //~| SUGGESTION Either::One(_t) - match r { - //~^ ERROR cannot move - &Either::One(_t) - //~^ HELP consider removing the `&` - //~| SUGGESTION Either::One(_t) - | &Either::Two(_t) => (), - // FIXME: would really like a suggestion here too - } - match r { - //~^ ERROR cannot move - &Either::One(_t) => (), - //~^ HELP consider removing the `&` - //~| SUGGESTION Either::One(_t) - &Either::Two(ref _t) => (), - } - match r { - //~^ ERROR cannot move - &Either::One(_t) => (), - //~^ HELP consider removing the `&` - //~| SUGGESTION Either::One(_t) - Either::Two(_t) => (), - } - fn f1(&X(_t): &X) { } - //~^ ERROR cannot move - //~| HELP consider removing the `&` - //~| SUGGESTION X(_t) - - let &mut X(_t) = sm; - //~^ ERROR cannot move - //~| HELP consider removing the `&mut` - //~| SUGGESTION X(_t) - if let &mut Either::One(_t) = rm { } - //~^ ERROR cannot move - //~| HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) - while let &mut Either::One(_t) = rm { } - //~^ ERROR cannot move - //~| HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) - match rm { - //~^ ERROR cannot move - &mut Either::One(_t) => (), - //~^ HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) - &mut Either::Two(_t) => (), - //~^ HELP consider removing the `&mut` - //~| SUGGESTION Either::Two(_t) - } - match rm { - //~^ ERROR cannot move - &mut Either::One(_t) => (), - //~^ HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) - &mut Either::Two(ref _t) => (), - } - match rm { - //~^ ERROR cannot move - &mut Either::One(_t) => (), - //~^ HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) - &mut Either::Two(ref mut _t) => (), - } - match rm { - //~^ ERROR cannot move - &mut Either::One(_t) => (), - //~^ HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) - Either::Two(_t) => (), - } - fn f2(&mut X(_t): &mut X) { } - //~^ ERROR cannot move - //~| HELP consider removing the `&mut` - //~| SUGGESTION X(_t) - - // -------- move from tuple of &Either/&X -------- - - // FIXME: These should have suggestions. - - let (&X(_t),) = (&x.clone(),); - //~^ ERROR cannot move - if let (&Either::One(_t),) = (&e.clone(),) { } - //~^ ERROR cannot move - while let (&Either::One(_t),) = (&e.clone(),) { } - //~^ ERROR cannot move - match (&e.clone(),) { - //~^ ERROR cannot move - (&Either::One(_t),) - | (&Either::Two(_t),) => (), - } - fn f3((&X(_t),): (&X,)) { } - //~^ ERROR cannot move - - let (&mut X(_t),) = (&mut xm.clone(),); - //~^ ERROR cannot move - if let (&mut Either::One(_t),) = (&mut em.clone(),) { } - //~^ ERROR cannot move - while let (&mut Either::One(_t),) = (&mut em.clone(),) { } - //~^ ERROR cannot move - match (&mut em.clone(),) { - //~^ ERROR cannot move - (&mut Either::One(_t),) => (), - (&mut Either::Two(_t),) => (), - } - fn f4((&mut X(_t),): (&mut X,)) { } - //~^ ERROR cannot move - - // -------- move from &Either/&X value -------- - - let &X(_t) = &x; - //~^ ERROR cannot move - //~| HELP consider removing the `&` - //~| SUGGESTION X(_t) - if let &Either::One(_t) = &e { } - //~^ ERROR cannot move - //~| HELP consider removing the `&` - //~| SUGGESTION Either::One(_t) - while let &Either::One(_t) = &e { } - //~^ ERROR cannot move - //~| HELP consider removing the `&` - //~| SUGGESTION Either::One(_t) - match &e { - //~^ ERROR cannot move - &Either::One(_t) - //~^ HELP consider removing the `&` - //~| SUGGESTION Either::One(_t) - | &Either::Two(_t) => (), - // FIXME: would really like a suggestion here too - } - match &e { - //~^ ERROR cannot move - &Either::One(_t) => (), - //~^ HELP consider removing the `&` - //~| SUGGESTION Either::One(_t) - &Either::Two(ref _t) => (), - } - match &e { - //~^ ERROR cannot move - &Either::One(_t) => (), - //~^ HELP consider removing the `&` - //~| SUGGESTION Either::One(_t) - Either::Two(_t) => (), - } - - let &mut X(_t) = &mut xm; - //~^ ERROR cannot move - //~| HELP consider removing the `&mut` - //~| SUGGESTION X(_t) - if let &mut Either::One(_t) = &mut em { } - //~^ ERROR cannot move - //~| HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) - while let &mut Either::One(_t) = &mut em { } - //~^ ERROR cannot move - //~| HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) - match &mut em { - //~^ ERROR cannot move - &mut Either::One(_t) - //~^ HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) - | &mut Either::Two(_t) => (), - // FIXME: would really like a suggestion here too - } - match &mut em { - //~^ ERROR cannot move - &mut Either::One(_t) => (), - //~^ HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) - &mut Either::Two(ref _t) => (), - } - match &mut em { - //~^ ERROR cannot move - &mut Either::One(_t) => (), - //~^ HELP consider removing the `&mut` - //~| SUGGESTION Either::One(_t) - &mut Either::Two(ref mut _t) => (), - } - match &mut em { - //~^ ERROR cannot move - &mut Either::One(_t) => (), - //~^ HELP consider removing the `&mut` - //~| 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)) -} diff --git a/src/test/ui/suggestions/dont-suggest-ref.stderr b/src/test/ui/suggestions/dont-suggest-ref.stderr deleted file mode 100644 index 8994152d1a5..00000000000 --- a/src/test/ui/suggestions/dont-suggest-ref.stderr +++ /dev/null @@ -1,1323 +0,0 @@ -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:50:17 - | -LL | let X(_t) = *s; - | -- ^^ - | | | - | | cannot move out of borrowed content - | | help: consider removing the `*`: `s` - | data moved here - | -note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:50:11 - | -LL | let X(_t) = *s; - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:54:30 - | -LL | if let Either::One(_t) = *r { } - | -- ^^ - | | | - | | cannot move out of borrowed content - | | help: consider removing the `*`: `r` - | data moved here - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:54:24 - | -LL | if let Either::One(_t) = *r { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:58:33 - | -LL | while let Either::One(_t) = *r { } - | -- ^^ - | | | - | | cannot move out of borrowed content - | | help: consider removing the `*`: `r` - | data moved here - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:58:27 - | -LL | while let Either::One(_t) = *r { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:62:11 - | -LL | match *r { - | ^^ - | | - | cannot move out of borrowed content - | help: consider removing the `*`: `r` -... -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.rs:66:21 - | -LL | Either::One(_t) - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:69:11 - | -LL | match *r { - | ^^ - | | - | cannot move out of borrowed content - | help: consider removing the `*`: `r` -... -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.rs:73:21 - | -LL | Either::One(_t) => (), - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:78:17 - | -LL | let X(_t) = *sm; - | -- ^^^ - | | | - | | cannot move out of borrowed content - | | help: consider removing the `*`: `sm` - | data moved here - | -note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:78:11 - | -LL | let X(_t) = *sm; - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:82:30 - | -LL | if let Either::One(_t) = *rm { } - | -- ^^^ - | | | - | | cannot move out of borrowed content - | | help: consider removing the `*`: `rm` - | data moved here - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:82:24 - | -LL | if let Either::One(_t) = *rm { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:86:33 - | -LL | while let Either::One(_t) = *rm { } - | -- ^^^ - | | | - | | cannot move out of borrowed content - | | help: consider removing the `*`: `rm` - | data moved here - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:86:27 - | -LL | while let Either::One(_t) = *rm { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:90:11 - | -LL | match *rm { - | ^^^ - | | - | cannot move out of borrowed content - | help: consider removing the `*`: `rm` -... -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.rs:94:21 - | -LL | Either::One(_t) - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:97:11 - | -LL | match *rm { - | ^^^ - | | - | cannot move out of borrowed content - | help: consider removing the `*`: `rm` -... -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.rs:101:21 - | -LL | Either::One(_t) => (), - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:105:11 - | -LL | match *rm { - | ^^^ - | | - | cannot move out of borrowed content - | help: consider removing the `*`: `rm` -... -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.rs:109:21 - | -LL | Either::One(_t) => (), - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:114:17 - | -LL | let X(_t) = vs[0]; - | -- ^^^^^ - | | | - | | cannot move out of borrowed content - | | help: consider borrowing here: `&vs[0]` - | data moved here - | -note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:114:11 - | -LL | let X(_t) = vs[0]; - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:118:30 - | -LL | if let Either::One(_t) = vr[0] { } - | -- ^^^^^ - | | | - | | cannot move out of borrowed content - | | help: consider borrowing here: `&vr[0]` - | data moved here - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:118:24 - | -LL | if let Either::One(_t) = vr[0] { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:122:33 - | -LL | while let Either::One(_t) = vr[0] { } - | -- ^^^^^ - | | | - | | cannot move out of borrowed content - | | help: consider borrowing here: `&vr[0]` - | data moved here - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:122:27 - | -LL | while let Either::One(_t) = vr[0] { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:126:11 - | -LL | match vr[0] { - | ^^^^^ - | | - | cannot move out of borrowed content - | help: consider borrowing here: `&vr[0]` -... -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.rs:130:21 - | -LL | Either::One(_t) - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:133:11 - | -LL | match vr[0] { - | ^^^^^ - | | - | cannot move out of borrowed content - | help: consider borrowing here: `&vr[0]` -... -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.rs:137:21 - | -LL | Either::One(_t) => (), - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:142:17 - | -LL | let X(_t) = vsm[0]; - | -- ^^^^^^ - | | | - | | cannot move out of borrowed content - | | help: consider borrowing here: `&vsm[0]` - | data moved here - | -note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:142:11 - | -LL | let X(_t) = vsm[0]; - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:146:30 - | -LL | if let Either::One(_t) = vrm[0] { } - | -- ^^^^^^ - | | | - | | cannot move out of borrowed content - | | help: consider borrowing here: `&vrm[0]` - | data moved here - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:146:24 - | -LL | if let Either::One(_t) = vrm[0] { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:150:33 - | -LL | while let Either::One(_t) = vrm[0] { } - | -- ^^^^^^ - | | | - | | cannot move out of borrowed content - | | help: consider borrowing here: `&vrm[0]` - | data moved here - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:150:27 - | -LL | while let Either::One(_t) = vrm[0] { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:154:11 - | -LL | match vrm[0] { - | ^^^^^^ - | | - | cannot move out of borrowed content - | help: consider borrowing here: `&vrm[0]` -... -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.rs:158:21 - | -LL | Either::One(_t) - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:161:11 - | -LL | match vrm[0] { - | ^^^^^^ - | | - | cannot move out of borrowed content - | help: consider borrowing here: `&vrm[0]` -... -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.rs:165:21 - | -LL | Either::One(_t) => (), - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:169:11 - | -LL | match vrm[0] { - | ^^^^^^ - | | - | cannot move out of borrowed content - | help: consider borrowing here: `&vrm[0]` -... -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.rs:173:21 - | -LL | Either::One(_t) => (), - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:180:18 - | -LL | let &X(_t) = s; - | ------ ^ cannot move out of borrowed content - | | | - | | data moved here - | help: consider removing the `&`: `X(_t)` - | -note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:180:12 - | -LL | let &X(_t) = s; - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:184:31 - | -LL | if let &Either::One(_t) = r { } - | ---------------- ^ cannot move out of borrowed content - | | | - | | data moved here - | help: consider removing the `&`: `Either::One(_t)` - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:184:25 - | -LL | if let &Either::One(_t) = r { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:188:34 - | -LL | while let &Either::One(_t) = r { } - | ---------------- ^ cannot move out of borrowed content - | | | - | | data moved here - | help: consider removing the `&`: `Either::One(_t)` - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:188:28 - | -LL | while let &Either::One(_t) = r { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:192:11 - | -LL | match r { - | ^ cannot move out of borrowed content -LL | //~^ ERROR cannot move -LL | &Either::One(_t) - | ---------------- - | | | - | | data moved here - | help: consider removing the `&`: `Either::One(_t)` - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:194:22 - | -LL | &Either::One(_t) - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:200:11 - | -LL | match r { - | ^ cannot move out of borrowed content -LL | //~^ ERROR cannot move -LL | &Either::One(_t) => (), - | ---------------- - | | | - | | data moved here - | help: consider removing the `&`: `Either::One(_t)` - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:202:22 - | -LL | &Either::One(_t) => (), - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:207:11 - | -LL | match r { - | ^ cannot move out of borrowed content -LL | //~^ ERROR cannot move -LL | &Either::One(_t) => (), - | ---------------- - | | | - | | data moved here - | help: consider removing the `&`: `Either::One(_t)` - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:209:22 - | -LL | &Either::One(_t) => (), - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:219:22 - | -LL | let &mut X(_t) = sm; - | ---------- ^^ cannot move out of borrowed content - | | | - | | data moved here - | help: consider removing the `&mut`: `X(_t)` - | -note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:219:16 - | -LL | let &mut X(_t) = sm; - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:223:35 - | -LL | if let &mut Either::One(_t) = rm { } - | -------------------- ^^ cannot move out of borrowed content - | | | - | | data moved here - | help: consider removing the `&mut`: `Either::One(_t)` - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:223:29 - | -LL | if let &mut Either::One(_t) = rm { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:227:38 - | -LL | while let &mut Either::One(_t) = rm { } - | -------------------- ^^ cannot move out of borrowed content - | | | - | | data moved here - | help: consider removing the `&mut`: `Either::One(_t)` - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:227:32 - | -LL | while let &mut Either::One(_t) = rm { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:231:11 - | -LL | match rm { - | ^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move -LL | &mut Either::One(_t) => (), - | -- data moved here -... -LL | &mut Either::Two(_t) => (), - | -- ...and here - | -note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:233:26 - | -LL | &mut Either::One(_t) => (), - | ^^ -... -LL | &mut Either::Two(_t) => (), - | ^^ -help: consider removing the `&mut` - | -LL | Either::One(_t) => (), - | ^^^^^^^^^^^^^^^ -help: consider removing the `&mut` - | -LL | Either::Two(_t) => (), - | ^^^^^^^^^^^^^^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:240:11 - | -LL | match rm { - | ^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move -LL | &mut Either::One(_t) => (), - | -------------------- - | | | - | | data moved here - | help: consider removing the `&mut`: `Either::One(_t)` - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:242:26 - | -LL | &mut Either::One(_t) => (), - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:247:11 - | -LL | match rm { - | ^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move -LL | &mut Either::One(_t) => (), - | -------------------- - | | | - | | data moved here - | help: consider removing the `&mut`: `Either::One(_t)` - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:249:26 - | -LL | &mut Either::One(_t) => (), - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:254:11 - | -LL | match rm { - | ^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move -LL | &mut Either::One(_t) => (), - | -------------------- - | | | - | | data moved here - | help: consider removing the `&mut`: `Either::One(_t)` - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:256:26 - | -LL | &mut Either::One(_t) => (), - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:270:21 - | -LL | let (&X(_t),) = (&x.clone(),); - | -- ^^^^^^^^^^^^^ cannot move out of borrowed content - | | - | data moved here - | -note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:270:13 - | -LL | let (&X(_t),) = (&x.clone(),); - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:272:34 - | -LL | if let (&Either::One(_t),) = (&e.clone(),) { } - | -- ^^^^^^^^^^^^^ cannot move out of borrowed content - | | - | data moved here - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:272:26 - | -LL | if let (&Either::One(_t),) = (&e.clone(),) { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:274:37 - | -LL | while let (&Either::One(_t),) = (&e.clone(),) { } - | -- ^^^^^^^^^^^^^ cannot move out of borrowed content - | | - | data moved here - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:274:29 - | -LL | while let (&Either::One(_t),) = (&e.clone(),) { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:276:11 - | -LL | match (&e.clone(),) { - | ^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move -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.rs:278:23 - | -LL | (&Either::One(_t),) - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:284:25 - | -LL | let (&mut X(_t),) = (&mut xm.clone(),); - | -- ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content - | | - | data moved here - | -note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:284:17 - | -LL | let (&mut X(_t),) = (&mut xm.clone(),); - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:286:38 - | -LL | if let (&mut Either::One(_t),) = (&mut em.clone(),) { } - | -- ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content - | | - | data moved here - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:286:30 - | -LL | if let (&mut Either::One(_t),) = (&mut em.clone(),) { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:288:41 - | -LL | while let (&mut Either::One(_t),) = (&mut em.clone(),) { } - | -- ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content - | | - | data moved here - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:288:33 - | -LL | while let (&mut Either::One(_t),) = (&mut em.clone(),) { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:290:11 - | -LL | match (&mut em.clone(),) { - | ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move -LL | (&mut Either::One(_t),) => (), - | -- data moved here -LL | (&mut Either::Two(_t),) => (), - | -- ...and here - | -note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:292:27 - | -LL | (&mut Either::One(_t),) => (), - | ^^ -LL | (&mut Either::Two(_t),) => (), - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:300:18 - | -LL | let &X(_t) = &x; - | ------ ^^ cannot move out of borrowed content - | | | - | | data moved here - | help: consider removing the `&`: `X(_t)` - | -note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:300:12 - | -LL | let &X(_t) = &x; - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:304:31 - | -LL | if let &Either::One(_t) = &e { } - | ---------------- ^^ cannot move out of borrowed content - | | | - | | data moved here - | help: consider removing the `&`: `Either::One(_t)` - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:304:25 - | -LL | if let &Either::One(_t) = &e { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:308:34 - | -LL | while let &Either::One(_t) = &e { } - | ---------------- ^^ cannot move out of borrowed content - | | | - | | data moved here - | help: consider removing the `&`: `Either::One(_t)` - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:308:28 - | -LL | while let &Either::One(_t) = &e { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:312:11 - | -LL | match &e { - | ^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move -LL | &Either::One(_t) - | ---------------- - | | | - | | data moved here - | help: consider removing the `&`: `Either::One(_t)` - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:314:22 - | -LL | &Either::One(_t) - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:320:11 - | -LL | match &e { - | ^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move -LL | &Either::One(_t) => (), - | ---------------- - | | | - | | data moved here - | help: consider removing the `&`: `Either::One(_t)` - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:322:22 - | -LL | &Either::One(_t) => (), - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:327:11 - | -LL | match &e { - | ^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move -LL | &Either::One(_t) => (), - | ---------------- - | | | - | | data moved here - | help: consider removing the `&`: `Either::One(_t)` - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:329:22 - | -LL | &Either::One(_t) => (), - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:335:22 - | -LL | let &mut X(_t) = &mut xm; - | ---------- ^^^^^^^ cannot move out of borrowed content - | | | - | | data moved here - | help: consider removing the `&mut`: `X(_t)` - | -note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:335:16 - | -LL | let &mut X(_t) = &mut xm; - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:339:35 - | -LL | if let &mut Either::One(_t) = &mut em { } - | -------------------- ^^^^^^^ cannot move out of borrowed content - | | | - | | data moved here - | help: consider removing the `&mut`: `Either::One(_t)` - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:339:29 - | -LL | if let &mut Either::One(_t) = &mut em { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:343:38 - | -LL | while let &mut Either::One(_t) = &mut em { } - | -------------------- ^^^^^^^ cannot move out of borrowed content - | | | - | | data moved here - | help: consider removing the `&mut`: `Either::One(_t)` - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:343:32 - | -LL | while let &mut Either::One(_t) = &mut em { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:347:11 - | -LL | match &mut em { - | ^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move -LL | &mut Either::One(_t) - | -------------------- - | | | - | | data moved here - | help: consider removing the `&mut`: `Either::One(_t)` - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:349:26 - | -LL | &mut Either::One(_t) - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:355:11 - | -LL | match &mut em { - | ^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move -LL | &mut Either::One(_t) => (), - | -------------------- - | | | - | | data moved here - | help: consider removing the `&mut`: `Either::One(_t)` - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:357:26 - | -LL | &mut Either::One(_t) => (), - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:362:11 - | -LL | match &mut em { - | ^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move -LL | &mut Either::One(_t) => (), - | -------------------- - | | | - | | data moved here - | help: consider removing the `&mut`: `Either::One(_t)` - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:364:26 - | -LL | &mut Either::One(_t) => (), - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:369:11 - | -LL | match &mut em { - | ^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move -LL | &mut Either::One(_t) => (), - | -------------------- - | | | - | | data moved here - | help: consider removing the `&mut`: `Either::One(_t)` - | -note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:371:26 - | -LL | &mut Either::One(_t) => (), - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:379: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/dont-suggest-ref.rs:379:13 - | -LL | let &(X(_t), X(_u)) = &(x.clone(), x.clone()); - | ^^ ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:383: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/dont-suggest-ref.rs:383:26 - | -LL | if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } - | ^^ ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:387: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/dont-suggest-ref.rs:387:29 - | -LL | while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } - | ^^ ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:391: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/dont-suggest-ref.rs:393: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/dont-suggest-ref.rs:401: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/dont-suggest-ref.rs:403:23 - | -LL | &(Either::One(_t), Either::Two(_u)) - | ^^ ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:410: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/dont-suggest-ref.rs:412:23 - | -LL | &(Either::One(_t), Either::Two(_u)) => (), - | ^^ ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:418: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/dont-suggest-ref.rs:420:23 - | -LL | &(Either::One(_t), Either::Two(_u)) => (), - | ^^ ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:431: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/dont-suggest-ref.rs:431:17 - | -LL | let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone()); - | ^^ ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:435: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/dont-suggest-ref.rs:435: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/dont-suggest-ref.rs:439: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/dont-suggest-ref.rs:439: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/dont-suggest-ref.rs:443: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/dont-suggest-ref.rs:445: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/dont-suggest-ref.rs:453: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/dont-suggest-ref.rs:455:27 - | -LL | &mut (Either::One(_t), Either::Two(_u)) - | ^^ ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:462: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/dont-suggest-ref.rs:464:27 - | -LL | &mut (Either::One(_t), Either::Two(_u)) => (), - | ^^ ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:470: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/dont-suggest-ref.rs:472:27 - | -LL | &mut (Either::One(_t), Either::Two(_u)) => (), - | ^^ ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:478: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/dont-suggest-ref.rs:480:27 - | -LL | &mut (Either::One(_t), Either::Two(_u)) => (), - | ^^ ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:214:11 - | -LL | fn f1(&X(_t): &X) { } - | ^^^--^ - | | | - | | data moved here - | cannot move out of borrowed content - | help: consider removing the `&`: `X(_t)` - | -note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:214:14 - | -LL | fn f1(&X(_t): &X) { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:261:11 - | -LL | fn f2(&mut X(_t): &mut X) { } - | ^^^^^^^--^ - | | | - | | data moved here - | cannot move out of borrowed content - | help: consider removing the `&mut`: `X(_t)` - | -note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:261:18 - | -LL | fn f2(&mut X(_t): &mut X) { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:281:11 - | -LL | fn f3((&X(_t),): (&X,)) { } - | ^^^^--^^^ - | | | - | | data moved here - | cannot move out of borrowed content - | -note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:281:15 - | -LL | fn f3((&X(_t),): (&X,)) { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:295:11 - | -LL | fn f4((&mut X(_t),): (&mut X,)) { } - | ^^^^^^^^--^^^ - | | | - | | data moved here - | cannot move out of borrowed content - | -note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/dont-suggest-ref.rs:295:19 - | -LL | fn f4((&mut X(_t),): (&mut X,)) { } - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:426: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/dont-suggest-ref.rs:426:15 - | -LL | fn f5(&(X(_t), X(_u)): &(X, X)) { } - | ^^ ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:486: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/dont-suggest-ref.rs:486:19 - | -LL | fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { } - | ^^ ^^ - -error: aborting due to 77 previous errors - -For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs b/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs new file mode 100644 index 00000000000..8cc847e693f --- /dev/null +++ b/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs @@ -0,0 +1,171 @@ +// 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 or the MIT license +// , 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; + +fn consume_fn(_f: F) { } + +fn consume_fnmut(_f: F) { } + +pub fn main() { } + +fn move_into_fn() { + let e = Either::One(X(Y)); + let mut em = Either::One(X(Y)); + + let x = X(Y); + + // -------- move into Fn -------- + + consume_fn(|| { + let X(_t) = x; + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &x + if let Either::One(_t) = e { } + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &e + while let Either::One(_t) = e { } + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &e + match e { + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &e + Either::One(_t) + | Either::Two(_t) => (), + } + match e { + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &e + Either::One(_t) => (), + Either::Two(ref _t) => (), + // FIXME: should suggest removing `ref` too + } + + let X(mut _t) = x; + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &x + if let Either::One(mut _t) = em { } + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &em + while let Either::One(mut _t) = em { } + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &em + match em { + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &em + Either::One(mut _t) + | Either::Two(mut _t) => (), + } + match em { + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &em + Either::One(mut _t) => (), + Either::Two(ref _t) => (), + // FIXME: should suggest removing `ref` too + } + }); +} + +fn move_into_fnmut() { + let e = Either::One(X(Y)); + let mut em = Either::One(X(Y)); + + let x = X(Y); + + // -------- move into FnMut -------- + + consume_fnmut(|| { + let X(_t) = x; + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &x + if let Either::One(_t) = e { } + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &e + while let Either::One(_t) = e { } + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &e + match e { + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &e + Either::One(_t) + | Either::Two(_t) => (), + } + match e { + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &e + Either::One(_t) => (), + Either::Two(ref _t) => (), + // FIXME: should suggest removing `ref` too + } + + let X(mut _t) = x; + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &x + if let Either::One(mut _t) = em { } + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &em + while let Either::One(mut _t) = em { } + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &em + match em { + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &em + Either::One(mut _t) + | Either::Two(mut _t) => (), + } + match em { + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &em + Either::One(mut _t) => (), + Either::Two(ref _t) => (), + // FIXME: should suggest removing `ref` too + } + match em { + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &em + Either::One(mut _t) => (), + Either::Two(ref mut _t) => (), + // FIXME: should suggest removing `ref` too + } + }); +} diff --git a/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.stderr b/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.stderr new file mode 100644 index 00000000000..825676b5fdf --- /dev/null +++ b/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.stderr @@ -0,0 +1,420 @@ +error[E0507]: cannot move out of captured variable in an `Fn` closure + --> $DIR/dont-suggest-ref-in-closure.rs:40:21 + | +LL | let x = X(Y); + | - captured outer variable +... +LL | let X(_t) = x; + | -- ^ + | | | + | | cannot move out of captured variable in an `Fn` closure + | | help: consider borrowing here: `&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 + | +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 + | +LL | let e = Either::One(X(Y)); + | - captured outer variable +... +LL | if let Either::One(_t) = e { } + | -- ^ + | | | + | | cannot move out of captured variable in an `Fn` closure + | | help: consider borrowing here: `&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 + | +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 + | +LL | let e = Either::One(X(Y)); + | - captured outer variable +... +LL | while let Either::One(_t) = e { } + | -- ^ + | | | + | | cannot move out of captured variable in an `Fn` closure + | | help: consider borrowing here: `&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 + | +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 + | +LL | let e = Either::One(X(Y)); + | - captured outer variable +... +LL | match e { + | ^ + | | + | cannot move out of captured variable in an `Fn` closure + | help: consider borrowing here: `&e` +... +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 + | +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 + | +LL | let e = Either::One(X(Y)); + | - captured outer variable +... +LL | match e { + | ^ + | | + | cannot move out of captured variable in an `Fn` closure + | help: consider borrowing here: `&e` +... +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 + | +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 + | +LL | let x = X(Y); + | - captured outer variable +... +LL | let X(mut _t) = x; + | ------ ^ + | | | + | | cannot move out of captured variable in an `Fn` closure + | | help: consider borrowing here: `&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 + | +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 + | +LL | let mut em = Either::One(X(Y)); + | ------ captured outer variable +... +LL | if let Either::One(mut _t) = em { } + | ------ ^^ + | | | + | | cannot move out of captured variable in an `Fn` closure + | | help: consider borrowing here: `&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 + | +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 + | +LL | let mut em = Either::One(X(Y)); + | ------ captured outer variable +... +LL | while let Either::One(mut _t) = em { } + | ------ ^^ + | | | + | | cannot move out of captured variable in an `Fn` closure + | | help: consider borrowing here: `&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 + | +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 + | +LL | let mut em = Either::One(X(Y)); + | ------ captured outer variable +... +LL | match em { + | ^^ + | | + | cannot move out of captured variable in an `Fn` closure + | help: consider borrowing here: `&em` +... +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 + | +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 + | +LL | let mut em = Either::One(X(Y)); + | ------ captured outer variable +... +LL | match em { + | ^^ + | | + | cannot move out of captured variable in an `Fn` closure + | help: consider borrowing here: `&em` +... +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 + | +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 + | +LL | let x = X(Y); + | - captured outer variable +... +LL | let X(_t) = x; + | -- ^ + | | | + | | cannot move out of captured variable in an `FnMut` closure + | | help: consider borrowing here: `&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 + | +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 + | +LL | let e = Either::One(X(Y)); + | - captured outer variable +... +LL | if let Either::One(_t) = e { } + | -- ^ + | | | + | | cannot move out of captured variable in an `FnMut` closure + | | help: consider borrowing here: `&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 + | +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 + | +LL | let e = Either::One(X(Y)); + | - captured outer variable +... +LL | while let Either::One(_t) = e { } + | -- ^ + | | | + | | cannot move out of captured variable in an `FnMut` closure + | | help: consider borrowing here: `&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 + | +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 + | +LL | let e = Either::One(X(Y)); + | - captured outer variable +... +LL | match e { + | ^ + | | + | cannot move out of captured variable in an `FnMut` closure + | help: consider borrowing here: `&e` +... +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 + | +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 + | +LL | let e = Either::One(X(Y)); + | - captured outer variable +... +LL | match e { + | ^ + | | + | cannot move out of captured variable in an `FnMut` closure + | help: consider borrowing here: `&e` +... +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 + | +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 + | +LL | let x = X(Y); + | - captured outer variable +... +LL | let X(mut _t) = x; + | ------ ^ + | | | + | | cannot move out of captured variable in an `FnMut` closure + | | help: consider borrowing here: `&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 + | +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 + | +LL | let mut em = Either::One(X(Y)); + | ------ captured outer variable +... +LL | if let Either::One(mut _t) = em { } + | ------ ^^ + | | | + | | cannot move out of captured variable in an `FnMut` closure + | | help: consider borrowing here: `&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 + | +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 + | +LL | let mut em = Either::One(X(Y)); + | ------ captured outer variable +... +LL | while let Either::One(mut _t) = em { } + | ------ ^^ + | | | + | | cannot move out of captured variable in an `FnMut` closure + | | help: consider borrowing here: `&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 + | +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 + | +LL | let mut em = Either::One(X(Y)); + | ------ captured outer variable +... +LL | match em { + | ^^ + | | + | cannot move out of captured variable in an `FnMut` closure + | help: consider borrowing here: `&em` +... +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 + | +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 + | +LL | let mut em = Either::One(X(Y)); + | ------ captured outer variable +... +LL | match em { + | ^^ + | | + | cannot move out of captured variable in an `FnMut` closure + | help: consider borrowing here: `&em` +... +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 + | +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 + | +LL | let mut em = Either::One(X(Y)); + | ------ captured outer variable +... +LL | match em { + | ^^ + | | + | cannot move out of captured variable in an `FnMut` closure + | help: consider borrowing here: `&em` +... +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 + | +LL | Either::One(mut _t) => (), + | ^^^^^^ + +error: aborting due to 21 previous errors + +For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/suggestions/dont-suggest-ref/simple.rs b/src/test/ui/suggestions/dont-suggest-ref/simple.rs new file mode 100644 index 00000000000..3bd6102c5d6 --- /dev/null +++ b/src/test/ui/suggestions/dont-suggest-ref/simple.rs @@ -0,0 +1,490 @@ +// 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 or the MIT license +// , 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)]; + + // -------- move from Either/X place -------- + + let X(_t) = *s; + //~^ ERROR cannot move + //~| HELP consider removing the `*` + //~| SUGGESTION s + if let Either::One(_t) = *r { } + //~^ ERROR cannot move + //~| HELP consider removing the `*` + //~| SUGGESTION r + while let Either::One(_t) = *r { } + //~^ ERROR cannot move + //~| HELP consider removing the `*` + //~| SUGGESTION r + match *r { + //~^ ERROR cannot move + //~| HELP consider removing the `*` + //~| SUGGESTION r + Either::One(_t) + | Either::Two(_t) => (), + } + match *r { + //~^ ERROR cannot move + //~| HELP consider removing the `*` + //~| SUGGESTION r + Either::One(_t) => (), + Either::Two(ref _t) => (), + // FIXME: should suggest removing `ref` too + } + + let X(_t) = *sm; + //~^ ERROR cannot move + //~| HELP consider removing the `*` + //~| SUGGESTION sm + if let Either::One(_t) = *rm { } + //~^ ERROR cannot move + //~| HELP consider removing the `*` + //~| SUGGESTION rm + while let Either::One(_t) = *rm { } + //~^ ERROR cannot move + //~| HELP consider removing the `*` + //~| SUGGESTION rm + match *rm { + //~^ ERROR cannot move + //~| HELP consider removing the `*` + //~| SUGGESTION rm + Either::One(_t) + | Either::Two(_t) => (), + } + match *rm { + //~^ ERROR cannot move + //~| HELP consider removing the `*` + //~| SUGGESTION rm + Either::One(_t) => (), + Either::Two(ref _t) => (), + // FIXME: should suggest removing `ref` too + } + match *rm { + //~^ ERROR cannot move + //~| HELP consider removing the `*` + //~| SUGGESTION rm + Either::One(_t) => (), + Either::Two(ref mut _t) => (), + // FIXME: should suggest removing `ref` too + } + + let X(_t) = vs[0]; + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &vs[0] + if let Either::One(_t) = vr[0] { } + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &vr[0] + while let Either::One(_t) = vr[0] { } + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &vr[0] + match vr[0] { + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &vr[0] + Either::One(_t) + | Either::Two(_t) => (), + } + match vr[0] { + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &vr[0] + Either::One(_t) => (), + Either::Two(ref _t) => (), + // FIXME: should suggest removing `ref` too + } + + let X(_t) = vsm[0]; + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &vsm[0] + if let Either::One(_t) = vrm[0] { } + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &vrm[0] + while let Either::One(_t) = vrm[0] { } + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &vrm[0] + match vrm[0] { + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &vrm[0] + Either::One(_t) + | Either::Two(_t) => (), + } + match vrm[0] { + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &vrm[0] + Either::One(_t) => (), + Either::Two(ref _t) => (), + // FIXME: should suggest removing `ref` too + } + match vrm[0] { + //~^ ERROR cannot move + //~| HELP consider borrowing here + //~| SUGGESTION &vrm[0] + Either::One(_t) => (), + Either::Two(ref mut _t) => (), + // FIXME: should suggest removing `ref` too + } + + // -------- move from &Either/&X place -------- + + let &X(_t) = s; + //~^ ERROR cannot move + //~| HELP consider removing the `&` + //~| SUGGESTION X(_t) + if let &Either::One(_t) = r { } + //~^ ERROR cannot move + //~| HELP consider removing the `&` + //~| SUGGESTION Either::One(_t) + while let &Either::One(_t) = r { } + //~^ ERROR cannot move + //~| HELP consider removing the `&` + //~| SUGGESTION Either::One(_t) + match r { + //~^ ERROR cannot move + &Either::One(_t) + //~^ HELP consider removing the `&` + //~| SUGGESTION Either::One(_t) + | &Either::Two(_t) => (), + // FIXME: would really like a suggestion here too + } + match r { + //~^ ERROR cannot move + &Either::One(_t) => (), + //~^ HELP consider removing the `&` + //~| SUGGESTION Either::One(_t) + &Either::Two(ref _t) => (), + } + match r { + //~^ ERROR cannot move + &Either::One(_t) => (), + //~^ HELP consider removing the `&` + //~| SUGGESTION Either::One(_t) + Either::Two(_t) => (), + } + fn f1(&X(_t): &X) { } + //~^ ERROR cannot move + //~| HELP consider removing the `&` + //~| SUGGESTION X(_t) + + let &mut X(_t) = sm; + //~^ ERROR cannot move + //~| HELP consider removing the `&mut` + //~| SUGGESTION X(_t) + if let &mut Either::One(_t) = rm { } + //~^ ERROR cannot move + //~| HELP consider removing the `&mut` + //~| SUGGESTION Either::One(_t) + while let &mut Either::One(_t) = rm { } + //~^ ERROR cannot move + //~| HELP consider removing the `&mut` + //~| SUGGESTION Either::One(_t) + match rm { + //~^ ERROR cannot move + &mut Either::One(_t) => (), + //~^ HELP consider removing the `&mut` + //~| SUGGESTION Either::One(_t) + &mut Either::Two(_t) => (), + //~^ HELP consider removing the `&mut` + //~| SUGGESTION Either::Two(_t) + } + match rm { + //~^ ERROR cannot move + &mut Either::One(_t) => (), + //~^ HELP consider removing the `&mut` + //~| SUGGESTION Either::One(_t) + &mut Either::Two(ref _t) => (), + } + match rm { + //~^ ERROR cannot move + &mut Either::One(_t) => (), + //~^ HELP consider removing the `&mut` + //~| SUGGESTION Either::One(_t) + &mut Either::Two(ref mut _t) => (), + } + match rm { + //~^ ERROR cannot move + &mut Either::One(_t) => (), + //~^ HELP consider removing the `&mut` + //~| SUGGESTION Either::One(_t) + Either::Two(_t) => (), + } + fn f2(&mut X(_t): &mut X) { } + //~^ ERROR cannot move + //~| HELP consider removing the `&mut` + //~| SUGGESTION X(_t) + + // -------- move from tuple of &Either/&X -------- + + // FIXME: These should have suggestions. + + let (&X(_t),) = (&x.clone(),); + //~^ ERROR cannot move + if let (&Either::One(_t),) = (&e.clone(),) { } + //~^ ERROR cannot move + while let (&Either::One(_t),) = (&e.clone(),) { } + //~^ ERROR cannot move + match (&e.clone(),) { + //~^ ERROR cannot move + (&Either::One(_t),) + | (&Either::Two(_t),) => (), + } + fn f3((&X(_t),): (&X,)) { } + //~^ ERROR cannot move + + let (&mut X(_t),) = (&mut xm.clone(),); + //~^ ERROR cannot move + if let (&mut Either::One(_t),) = (&mut em.clone(),) { } + //~^ ERROR cannot move + while let (&mut Either::One(_t),) = (&mut em.clone(),) { } + //~^ ERROR cannot move + match (&mut em.clone(),) { + //~^ ERROR cannot move + (&mut Either::One(_t),) => (), + (&mut Either::Two(_t),) => (), + } + fn f4((&mut X(_t),): (&mut X,)) { } + //~^ ERROR cannot move + + // -------- move from &Either/&X value -------- + + let &X(_t) = &x; + //~^ ERROR cannot move + //~| HELP consider removing the `&` + //~| SUGGESTION X(_t) + if let &Either::One(_t) = &e { } + //~^ ERROR cannot move + //~| HELP consider removing the `&` + //~| SUGGESTION Either::One(_t) + while let &Either::One(_t) = &e { } + //~^ ERROR cannot move + //~| HELP consider removing the `&` + //~| SUGGESTION Either::One(_t) + match &e { + //~^ ERROR cannot move + &Either::One(_t) + //~^ HELP consider removing the `&` + //~| SUGGESTION Either::One(_t) + | &Either::Two(_t) => (), + // FIXME: would really like a suggestion here too + } + match &e { + //~^ ERROR cannot move + &Either::One(_t) => (), + //~^ HELP consider removing the `&` + //~| SUGGESTION Either::One(_t) + &Either::Two(ref _t) => (), + } + match &e { + //~^ ERROR cannot move + &Either::One(_t) => (), + //~^ HELP consider removing the `&` + //~| SUGGESTION Either::One(_t) + Either::Two(_t) => (), + } + + let &mut X(_t) = &mut xm; + //~^ ERROR cannot move + //~| HELP consider removing the `&mut` + //~| SUGGESTION X(_t) + if let &mut Either::One(_t) = &mut em { } + //~^ ERROR cannot move + //~| HELP consider removing the `&mut` + //~| SUGGESTION Either::One(_t) + while let &mut Either::One(_t) = &mut em { } + //~^ ERROR cannot move + //~| HELP consider removing the `&mut` + //~| SUGGESTION Either::One(_t) + match &mut em { + //~^ ERROR cannot move + &mut Either::One(_t) + //~^ HELP consider removing the `&mut` + //~| SUGGESTION Either::One(_t) + | &mut Either::Two(_t) => (), + // FIXME: would really like a suggestion here too + } + match &mut em { + //~^ ERROR cannot move + &mut Either::One(_t) => (), + //~^ HELP consider removing the `&mut` + //~| SUGGESTION Either::One(_t) + &mut Either::Two(ref _t) => (), + } + match &mut em { + //~^ ERROR cannot move + &mut Either::One(_t) => (), + //~^ HELP consider removing the `&mut` + //~| SUGGESTION Either::One(_t) + &mut Either::Two(ref mut _t) => (), + } + match &mut em { + //~^ ERROR cannot move + &mut Either::One(_t) => (), + //~^ HELP consider removing the `&mut` + //~| 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)) +} diff --git a/src/test/ui/suggestions/dont-suggest-ref/simple.stderr b/src/test/ui/suggestions/dont-suggest-ref/simple.stderr new file mode 100644 index 00000000000..8994152d1a5 --- /dev/null +++ b/src/test/ui/suggestions/dont-suggest-ref/simple.stderr @@ -0,0 +1,1323 @@ +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:50:17 + | +LL | let X(_t) = *s; + | -- ^^ + | | | + | | cannot move out of borrowed content + | | help: consider removing the `*`: `s` + | data moved here + | +note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:50:11 + | +LL | let X(_t) = *s; + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:54:30 + | +LL | if let Either::One(_t) = *r { } + | -- ^^ + | | | + | | cannot move out of borrowed content + | | help: consider removing the `*`: `r` + | data moved here + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:54:24 + | +LL | if let Either::One(_t) = *r { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:58:33 + | +LL | while let Either::One(_t) = *r { } + | -- ^^ + | | | + | | cannot move out of borrowed content + | | help: consider removing the `*`: `r` + | data moved here + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:58:27 + | +LL | while let Either::One(_t) = *r { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:62:11 + | +LL | match *r { + | ^^ + | | + | cannot move out of borrowed content + | help: consider removing the `*`: `r` +... +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.rs:66:21 + | +LL | Either::One(_t) + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:69:11 + | +LL | match *r { + | ^^ + | | + | cannot move out of borrowed content + | help: consider removing the `*`: `r` +... +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.rs:73:21 + | +LL | Either::One(_t) => (), + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:78:17 + | +LL | let X(_t) = *sm; + | -- ^^^ + | | | + | | cannot move out of borrowed content + | | help: consider removing the `*`: `sm` + | data moved here + | +note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:78:11 + | +LL | let X(_t) = *sm; + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:82:30 + | +LL | if let Either::One(_t) = *rm { } + | -- ^^^ + | | | + | | cannot move out of borrowed content + | | help: consider removing the `*`: `rm` + | data moved here + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:82:24 + | +LL | if let Either::One(_t) = *rm { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:86:33 + | +LL | while let Either::One(_t) = *rm { } + | -- ^^^ + | | | + | | cannot move out of borrowed content + | | help: consider removing the `*`: `rm` + | data moved here + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:86:27 + | +LL | while let Either::One(_t) = *rm { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:90:11 + | +LL | match *rm { + | ^^^ + | | + | cannot move out of borrowed content + | help: consider removing the `*`: `rm` +... +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.rs:94:21 + | +LL | Either::One(_t) + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:97:11 + | +LL | match *rm { + | ^^^ + | | + | cannot move out of borrowed content + | help: consider removing the `*`: `rm` +... +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.rs:101:21 + | +LL | Either::One(_t) => (), + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:105:11 + | +LL | match *rm { + | ^^^ + | | + | cannot move out of borrowed content + | help: consider removing the `*`: `rm` +... +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.rs:109:21 + | +LL | Either::One(_t) => (), + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:114:17 + | +LL | let X(_t) = vs[0]; + | -- ^^^^^ + | | | + | | cannot move out of borrowed content + | | help: consider borrowing here: `&vs[0]` + | data moved here + | +note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:114:11 + | +LL | let X(_t) = vs[0]; + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:118:30 + | +LL | if let Either::One(_t) = vr[0] { } + | -- ^^^^^ + | | | + | | cannot move out of borrowed content + | | help: consider borrowing here: `&vr[0]` + | data moved here + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:118:24 + | +LL | if let Either::One(_t) = vr[0] { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:122:33 + | +LL | while let Either::One(_t) = vr[0] { } + | -- ^^^^^ + | | | + | | cannot move out of borrowed content + | | help: consider borrowing here: `&vr[0]` + | data moved here + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:122:27 + | +LL | while let Either::One(_t) = vr[0] { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:126:11 + | +LL | match vr[0] { + | ^^^^^ + | | + | cannot move out of borrowed content + | help: consider borrowing here: `&vr[0]` +... +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.rs:130:21 + | +LL | Either::One(_t) + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:133:11 + | +LL | match vr[0] { + | ^^^^^ + | | + | cannot move out of borrowed content + | help: consider borrowing here: `&vr[0]` +... +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.rs:137:21 + | +LL | Either::One(_t) => (), + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:142:17 + | +LL | let X(_t) = vsm[0]; + | -- ^^^^^^ + | | | + | | cannot move out of borrowed content + | | help: consider borrowing here: `&vsm[0]` + | data moved here + | +note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:142:11 + | +LL | let X(_t) = vsm[0]; + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:146:30 + | +LL | if let Either::One(_t) = vrm[0] { } + | -- ^^^^^^ + | | | + | | cannot move out of borrowed content + | | help: consider borrowing here: `&vrm[0]` + | data moved here + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:146:24 + | +LL | if let Either::One(_t) = vrm[0] { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:150:33 + | +LL | while let Either::One(_t) = vrm[0] { } + | -- ^^^^^^ + | | | + | | cannot move out of borrowed content + | | help: consider borrowing here: `&vrm[0]` + | data moved here + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:150:27 + | +LL | while let Either::One(_t) = vrm[0] { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:154:11 + | +LL | match vrm[0] { + | ^^^^^^ + | | + | cannot move out of borrowed content + | help: consider borrowing here: `&vrm[0]` +... +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.rs:158:21 + | +LL | Either::One(_t) + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:161:11 + | +LL | match vrm[0] { + | ^^^^^^ + | | + | cannot move out of borrowed content + | help: consider borrowing here: `&vrm[0]` +... +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.rs:165:21 + | +LL | Either::One(_t) => (), + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:169:11 + | +LL | match vrm[0] { + | ^^^^^^ + | | + | cannot move out of borrowed content + | help: consider borrowing here: `&vrm[0]` +... +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.rs:173:21 + | +LL | Either::One(_t) => (), + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:180:18 + | +LL | let &X(_t) = s; + | ------ ^ cannot move out of borrowed content + | | | + | | data moved here + | help: consider removing the `&`: `X(_t)` + | +note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:180:12 + | +LL | let &X(_t) = s; + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:184:31 + | +LL | if let &Either::One(_t) = r { } + | ---------------- ^ cannot move out of borrowed content + | | | + | | data moved here + | help: consider removing the `&`: `Either::One(_t)` + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:184:25 + | +LL | if let &Either::One(_t) = r { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:188:34 + | +LL | while let &Either::One(_t) = r { } + | ---------------- ^ cannot move out of borrowed content + | | | + | | data moved here + | help: consider removing the `&`: `Either::One(_t)` + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:188:28 + | +LL | while let &Either::One(_t) = r { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:192:11 + | +LL | match r { + | ^ cannot move out of borrowed content +LL | //~^ ERROR cannot move +LL | &Either::One(_t) + | ---------------- + | | | + | | data moved here + | help: consider removing the `&`: `Either::One(_t)` + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:194:22 + | +LL | &Either::One(_t) + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:200:11 + | +LL | match r { + | ^ cannot move out of borrowed content +LL | //~^ ERROR cannot move +LL | &Either::One(_t) => (), + | ---------------- + | | | + | | data moved here + | help: consider removing the `&`: `Either::One(_t)` + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:202:22 + | +LL | &Either::One(_t) => (), + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:207:11 + | +LL | match r { + | ^ cannot move out of borrowed content +LL | //~^ ERROR cannot move +LL | &Either::One(_t) => (), + | ---------------- + | | | + | | data moved here + | help: consider removing the `&`: `Either::One(_t)` + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:209:22 + | +LL | &Either::One(_t) => (), + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:219:22 + | +LL | let &mut X(_t) = sm; + | ---------- ^^ cannot move out of borrowed content + | | | + | | data moved here + | help: consider removing the `&mut`: `X(_t)` + | +note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:219:16 + | +LL | let &mut X(_t) = sm; + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:223:35 + | +LL | if let &mut Either::One(_t) = rm { } + | -------------------- ^^ cannot move out of borrowed content + | | | + | | data moved here + | help: consider removing the `&mut`: `Either::One(_t)` + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:223:29 + | +LL | if let &mut Either::One(_t) = rm { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:227:38 + | +LL | while let &mut Either::One(_t) = rm { } + | -------------------- ^^ cannot move out of borrowed content + | | | + | | data moved here + | help: consider removing the `&mut`: `Either::One(_t)` + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:227:32 + | +LL | while let &mut Either::One(_t) = rm { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:231:11 + | +LL | match rm { + | ^^ cannot move out of borrowed content +LL | //~^ ERROR cannot move +LL | &mut Either::One(_t) => (), + | -- data moved here +... +LL | &mut Either::Two(_t) => (), + | -- ...and here + | +note: move occurs because these variables have types that don't implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:233:26 + | +LL | &mut Either::One(_t) => (), + | ^^ +... +LL | &mut Either::Two(_t) => (), + | ^^ +help: consider removing the `&mut` + | +LL | Either::One(_t) => (), + | ^^^^^^^^^^^^^^^ +help: consider removing the `&mut` + | +LL | Either::Two(_t) => (), + | ^^^^^^^^^^^^^^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:240:11 + | +LL | match rm { + | ^^ cannot move out of borrowed content +LL | //~^ ERROR cannot move +LL | &mut Either::One(_t) => (), + | -------------------- + | | | + | | data moved here + | help: consider removing the `&mut`: `Either::One(_t)` + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:242:26 + | +LL | &mut Either::One(_t) => (), + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:247:11 + | +LL | match rm { + | ^^ cannot move out of borrowed content +LL | //~^ ERROR cannot move +LL | &mut Either::One(_t) => (), + | -------------------- + | | | + | | data moved here + | help: consider removing the `&mut`: `Either::One(_t)` + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:249:26 + | +LL | &mut Either::One(_t) => (), + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:254:11 + | +LL | match rm { + | ^^ cannot move out of borrowed content +LL | //~^ ERROR cannot move +LL | &mut Either::One(_t) => (), + | -------------------- + | | | + | | data moved here + | help: consider removing the `&mut`: `Either::One(_t)` + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:256:26 + | +LL | &mut Either::One(_t) => (), + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:270:21 + | +LL | let (&X(_t),) = (&x.clone(),); + | -- ^^^^^^^^^^^^^ cannot move out of borrowed content + | | + | data moved here + | +note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:270:13 + | +LL | let (&X(_t),) = (&x.clone(),); + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:272:34 + | +LL | if let (&Either::One(_t),) = (&e.clone(),) { } + | -- ^^^^^^^^^^^^^ cannot move out of borrowed content + | | + | data moved here + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:272:26 + | +LL | if let (&Either::One(_t),) = (&e.clone(),) { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:274:37 + | +LL | while let (&Either::One(_t),) = (&e.clone(),) { } + | -- ^^^^^^^^^^^^^ cannot move out of borrowed content + | | + | data moved here + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:274:29 + | +LL | while let (&Either::One(_t),) = (&e.clone(),) { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:276:11 + | +LL | match (&e.clone(),) { + | ^^^^^^^^^^^^^ cannot move out of borrowed content +LL | //~^ ERROR cannot move +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.rs:278:23 + | +LL | (&Either::One(_t),) + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:284:25 + | +LL | let (&mut X(_t),) = (&mut xm.clone(),); + | -- ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content + | | + | data moved here + | +note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:284:17 + | +LL | let (&mut X(_t),) = (&mut xm.clone(),); + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:286:38 + | +LL | if let (&mut Either::One(_t),) = (&mut em.clone(),) { } + | -- ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content + | | + | data moved here + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:286:30 + | +LL | if let (&mut Either::One(_t),) = (&mut em.clone(),) { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:288:41 + | +LL | while let (&mut Either::One(_t),) = (&mut em.clone(),) { } + | -- ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content + | | + | data moved here + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:288:33 + | +LL | while let (&mut Either::One(_t),) = (&mut em.clone(),) { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:290:11 + | +LL | match (&mut em.clone(),) { + | ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content +LL | //~^ ERROR cannot move +LL | (&mut Either::One(_t),) => (), + | -- data moved here +LL | (&mut Either::Two(_t),) => (), + | -- ...and here + | +note: move occurs because these variables have types that don't implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:292:27 + | +LL | (&mut Either::One(_t),) => (), + | ^^ +LL | (&mut Either::Two(_t),) => (), + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:300:18 + | +LL | let &X(_t) = &x; + | ------ ^^ cannot move out of borrowed content + | | | + | | data moved here + | help: consider removing the `&`: `X(_t)` + | +note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:300:12 + | +LL | let &X(_t) = &x; + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:304:31 + | +LL | if let &Either::One(_t) = &e { } + | ---------------- ^^ cannot move out of borrowed content + | | | + | | data moved here + | help: consider removing the `&`: `Either::One(_t)` + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:304:25 + | +LL | if let &Either::One(_t) = &e { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:308:34 + | +LL | while let &Either::One(_t) = &e { } + | ---------------- ^^ cannot move out of borrowed content + | | | + | | data moved here + | help: consider removing the `&`: `Either::One(_t)` + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:308:28 + | +LL | while let &Either::One(_t) = &e { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:312:11 + | +LL | match &e { + | ^^ cannot move out of borrowed content +LL | //~^ ERROR cannot move +LL | &Either::One(_t) + | ---------------- + | | | + | | data moved here + | help: consider removing the `&`: `Either::One(_t)` + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:314:22 + | +LL | &Either::One(_t) + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:320:11 + | +LL | match &e { + | ^^ cannot move out of borrowed content +LL | //~^ ERROR cannot move +LL | &Either::One(_t) => (), + | ---------------- + | | | + | | data moved here + | help: consider removing the `&`: `Either::One(_t)` + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:322:22 + | +LL | &Either::One(_t) => (), + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:327:11 + | +LL | match &e { + | ^^ cannot move out of borrowed content +LL | //~^ ERROR cannot move +LL | &Either::One(_t) => (), + | ---------------- + | | | + | | data moved here + | help: consider removing the `&`: `Either::One(_t)` + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:329:22 + | +LL | &Either::One(_t) => (), + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:335:22 + | +LL | let &mut X(_t) = &mut xm; + | ---------- ^^^^^^^ cannot move out of borrowed content + | | | + | | data moved here + | help: consider removing the `&mut`: `X(_t)` + | +note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:335:16 + | +LL | let &mut X(_t) = &mut xm; + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:339:35 + | +LL | if let &mut Either::One(_t) = &mut em { } + | -------------------- ^^^^^^^ cannot move out of borrowed content + | | | + | | data moved here + | help: consider removing the `&mut`: `Either::One(_t)` + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:339:29 + | +LL | if let &mut Either::One(_t) = &mut em { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:343:38 + | +LL | while let &mut Either::One(_t) = &mut em { } + | -------------------- ^^^^^^^ cannot move out of borrowed content + | | | + | | data moved here + | help: consider removing the `&mut`: `Either::One(_t)` + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:343:32 + | +LL | while let &mut Either::One(_t) = &mut em { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:347:11 + | +LL | match &mut em { + | ^^^^^^^ cannot move out of borrowed content +LL | //~^ ERROR cannot move +LL | &mut Either::One(_t) + | -------------------- + | | | + | | data moved here + | help: consider removing the `&mut`: `Either::One(_t)` + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:349:26 + | +LL | &mut Either::One(_t) + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:355:11 + | +LL | match &mut em { + | ^^^^^^^ cannot move out of borrowed content +LL | //~^ ERROR cannot move +LL | &mut Either::One(_t) => (), + | -------------------- + | | | + | | data moved here + | help: consider removing the `&mut`: `Either::One(_t)` + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:357:26 + | +LL | &mut Either::One(_t) => (), + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:362:11 + | +LL | match &mut em { + | ^^^^^^^ cannot move out of borrowed content +LL | //~^ ERROR cannot move +LL | &mut Either::One(_t) => (), + | -------------------- + | | | + | | data moved here + | help: consider removing the `&mut`: `Either::One(_t)` + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:364:26 + | +LL | &mut Either::One(_t) => (), + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:369:11 + | +LL | match &mut em { + | ^^^^^^^ cannot move out of borrowed content +LL | //~^ ERROR cannot move +LL | &mut Either::One(_t) => (), + | -------------------- + | | | + | | data moved here + | help: consider removing the `&mut`: `Either::One(_t)` + | +note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:371:26 + | +LL | &mut Either::One(_t) => (), + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:379: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/dont-suggest-ref.rs:379:13 + | +LL | let &(X(_t), X(_u)) = &(x.clone(), x.clone()); + | ^^ ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:383: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/dont-suggest-ref.rs:383:26 + | +LL | if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } + | ^^ ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:387: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/dont-suggest-ref.rs:387:29 + | +LL | while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } + | ^^ ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:391: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/dont-suggest-ref.rs:393: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/dont-suggest-ref.rs:401: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/dont-suggest-ref.rs:403:23 + | +LL | &(Either::One(_t), Either::Two(_u)) + | ^^ ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:410: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/dont-suggest-ref.rs:412:23 + | +LL | &(Either::One(_t), Either::Two(_u)) => (), + | ^^ ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:418: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/dont-suggest-ref.rs:420:23 + | +LL | &(Either::One(_t), Either::Two(_u)) => (), + | ^^ ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:431: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/dont-suggest-ref.rs:431:17 + | +LL | let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone()); + | ^^ ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:435: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/dont-suggest-ref.rs:435: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/dont-suggest-ref.rs:439: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/dont-suggest-ref.rs:439: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/dont-suggest-ref.rs:443: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/dont-suggest-ref.rs:445: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/dont-suggest-ref.rs:453: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/dont-suggest-ref.rs:455:27 + | +LL | &mut (Either::One(_t), Either::Two(_u)) + | ^^ ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:462: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/dont-suggest-ref.rs:464:27 + | +LL | &mut (Either::One(_t), Either::Two(_u)) => (), + | ^^ ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:470: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/dont-suggest-ref.rs:472:27 + | +LL | &mut (Either::One(_t), Either::Two(_u)) => (), + | ^^ ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:478: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/dont-suggest-ref.rs:480:27 + | +LL | &mut (Either::One(_t), Either::Two(_u)) => (), + | ^^ ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:214:11 + | +LL | fn f1(&X(_t): &X) { } + | ^^^--^ + | | | + | | data moved here + | cannot move out of borrowed content + | help: consider removing the `&`: `X(_t)` + | +note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:214:14 + | +LL | fn f1(&X(_t): &X) { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:261:11 + | +LL | fn f2(&mut X(_t): &mut X) { } + | ^^^^^^^--^ + | | | + | | data moved here + | cannot move out of borrowed content + | help: consider removing the `&mut`: `X(_t)` + | +note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:261:18 + | +LL | fn f2(&mut X(_t): &mut X) { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:281:11 + | +LL | fn f3((&X(_t),): (&X,)) { } + | ^^^^--^^^ + | | | + | | data moved here + | cannot move out of borrowed content + | +note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:281:15 + | +LL | fn f3((&X(_t),): (&X,)) { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:295:11 + | +LL | fn f4((&mut X(_t),): (&mut X,)) { } + | ^^^^^^^^--^^^ + | | | + | | data moved here + | cannot move out of borrowed content + | +note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait + --> $DIR/dont-suggest-ref.rs:295:19 + | +LL | fn f4((&mut X(_t),): (&mut X,)) { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:426: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/dont-suggest-ref.rs:426:15 + | +LL | fn f5(&(X(_t), X(_u)): &(X, X)) { } + | ^^ ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:486: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/dont-suggest-ref.rs:486:19 + | +LL | fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { } + | ^^ ^^ + +error: aborting due to 77 previous errors + +For more information about this error, try `rustc --explain E0507`. -- cgit 1.4.1-3-g733a5