From 0a82abc47b729244d699a11e7f30c1337f2e5cc9 Mon Sep 17 00:00:00 2001 From: ashtneoi Date: Mon, 13 Aug 2018 15:52:23 -0700 Subject: [PATCH] Test patterns in tuples --- src/test/ui/suggestions/dont-suggest-ref.rs | 42 ++- .../ui/suggestions/dont-suggest-ref.stderr | 278 ++++++++++++++---- 2 files changed, 249 insertions(+), 71 deletions(-) diff --git a/src/test/ui/suggestions/dont-suggest-ref.rs b/src/test/ui/suggestions/dont-suggest-ref.rs index 8fa19e84e4c..67e8b4a0e95 100644 --- a/src/test/ui/suggestions/dont-suggest-ref.rs +++ b/src/test/ui/suggestions/dont-suggest-ref.rs @@ -45,7 +45,7 @@ pub fn main() { let vs = &vx; let vsm = &mut vec![X(Y)]; - // -------- + // -------- move from Either/X place -------- let X(_t) = *s; //~^ ERROR cannot move @@ -175,7 +175,7 @@ pub fn main() { // FIXME: should suggest removing `ref mut` too } - // -------- + // -------- move from &Either/&X place -------- let &X(_t) = s; //~^ ERROR cannot move @@ -263,7 +263,37 @@ pub fn main() { //~| HELP consider removing the `&mut` //~| SUGGESTION X(_t) - // -------- + // -------- move from tuple of &Either/&X (no 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 @@ -342,7 +372,7 @@ pub fn main() { Either::Two(_t) => (), } - // -------- + // -------- test for duplicate suggestions -------- let &(X(_t), X(_u)) = &(x.clone(), x.clone()); //~^ ERROR cannot move @@ -391,7 +421,7 @@ pub fn main() { (Either::Two(_t), Either::One(_u)) => (), _ => (), } - fn f3(&(X(_t), X(_u)): &(X, X)) { } + fn f5(&(X(_t), X(_u)): &(X, X)) { } //~^ ERROR cannot move //~| HELP consider removing the `&` //~| SUGGESTION (X(_t), X(_u)) @@ -451,7 +481,7 @@ pub fn main() { (Either::Two(_t), Either::One(_u)) => (), _ => (), } - fn f4(&mut (X(_t), X(_u)): &mut (X, X)) { } + 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 index 8bc9209c2ed..00fe78d9164 100644 --- a/src/test/ui/suggestions/dont-suggest-ref.stderr +++ b/src/test/ui/suggestions/dont-suggest-ref.stderr @@ -598,7 +598,125 @@ LL | &mut Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:268:18 + --> $DIR/dont-suggest-ref.rs:268: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:268:13 + | +LL | let (&X(_t),) = (&x.clone(),); + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:270: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:270:26 + | +LL | if let (&Either::One(_t),) = (&e.clone(),) { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:272: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:272:29 + | +LL | while let (&Either::One(_t),) = (&e.clone(),) { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:274: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:276:23 + | +LL | (&Either::One(_t),) + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:282: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:282:17 + | +LL | let (&mut X(_t),) = (&mut xm.clone(),); + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:284: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:284:30 + | +LL | if let (&mut Either::One(_t),) = (&mut em.clone(),) { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:286: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:286:33 + | +LL | while let (&mut Either::One(_t),) = (&mut em.clone(),) { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:288: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:290:27 + | +LL | (&mut Either::One(_t),) => (), + | ^^ +LL | (&mut Either::Two(_t),) => (), + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:298:18 | LL | let &X(_t) = &x; | ------ ^^ cannot move out of borrowed content @@ -607,13 +725,13 @@ LL | let &X(_t) = &x; | 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:268:12 + --> $DIR/dont-suggest-ref.rs:298:12 | LL | let &X(_t) = &x; | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:272:31 + --> $DIR/dont-suggest-ref.rs:302:31 | LL | if let &Either::One(_t) = &e { } | ---------------- ^^ cannot move out of borrowed content @@ -622,13 +740,13 @@ LL | if let &Either::One(_t) = &e { } | 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:272:25 + --> $DIR/dont-suggest-ref.rs:302:25 | LL | if let &Either::One(_t) = &e { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:276:34 + --> $DIR/dont-suggest-ref.rs:306:34 | LL | while let &Either::One(_t) = &e { } | ---------------- ^^ cannot move out of borrowed content @@ -637,13 +755,13 @@ LL | while let &Either::One(_t) = &e { } | 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:276:28 + --> $DIR/dont-suggest-ref.rs:306:28 | LL | while let &Either::One(_t) = &e { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:280:11 + --> $DIR/dont-suggest-ref.rs:310:11 | LL | match &e { | ^^ cannot move out of borrowed content @@ -655,13 +773,13 @@ LL | &Either::One(_t) | 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:282:22 + --> $DIR/dont-suggest-ref.rs:312:22 | LL | &Either::One(_t) | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:288:11 + --> $DIR/dont-suggest-ref.rs:318:11 | LL | match &e { | ^^ cannot move out of borrowed content @@ -673,13 +791,13 @@ LL | &Either::One(_t) => (), | 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:290:22 + --> $DIR/dont-suggest-ref.rs:320:22 | LL | &Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:295:11 + --> $DIR/dont-suggest-ref.rs:325:11 | LL | match &e { | ^^ cannot move out of borrowed content @@ -691,13 +809,13 @@ LL | &Either::One(_t) => (), | 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:297:22 + --> $DIR/dont-suggest-ref.rs:327:22 | LL | &Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:303:22 + --> $DIR/dont-suggest-ref.rs:333:22 | LL | let &mut X(_t) = &mut xm; | ---------- ^^^^^^^ cannot move out of borrowed content @@ -706,13 +824,13 @@ LL | let &mut X(_t) = &mut xm; | 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:303:16 + --> $DIR/dont-suggest-ref.rs:333:16 | LL | let &mut X(_t) = &mut xm; | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:307:35 + --> $DIR/dont-suggest-ref.rs:337:35 | LL | if let &mut Either::One(_t) = &mut em { } | -------------------- ^^^^^^^ cannot move out of borrowed content @@ -721,13 +839,13 @@ LL | if let &mut Either::One(_t) = &mut em { } | 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:307:29 + --> $DIR/dont-suggest-ref.rs:337:29 | LL | if let &mut Either::One(_t) = &mut em { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:311:38 + --> $DIR/dont-suggest-ref.rs:341:38 | LL | while let &mut Either::One(_t) = &mut em { } | -------------------- ^^^^^^^ cannot move out of borrowed content @@ -736,13 +854,13 @@ LL | while let &mut Either::One(_t) = &mut em { } | 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:311:32 + --> $DIR/dont-suggest-ref.rs:341:32 | LL | while let &mut Either::One(_t) = &mut em { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:315:11 + --> $DIR/dont-suggest-ref.rs:345:11 | LL | match &mut em { | ^^^^^^^ cannot move out of borrowed content @@ -754,13 +872,13 @@ LL | &mut Either::One(_t) | 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:317:26 + --> $DIR/dont-suggest-ref.rs:347:26 | LL | &mut Either::One(_t) | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:323:11 + --> $DIR/dont-suggest-ref.rs:353:11 | LL | match &mut em { | ^^^^^^^ cannot move out of borrowed content @@ -772,13 +890,13 @@ LL | &mut Either::One(_t) => (), | 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:325:26 + --> $DIR/dont-suggest-ref.rs:355:26 | LL | &mut Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:330:11 + --> $DIR/dont-suggest-ref.rs:360:11 | LL | match &mut em { | ^^^^^^^ cannot move out of borrowed content @@ -790,13 +908,13 @@ LL | &mut Either::One(_t) => (), | 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:332:26 + --> $DIR/dont-suggest-ref.rs:362:26 | LL | &mut Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:337:11 + --> $DIR/dont-suggest-ref.rs:367:11 | LL | match &mut em { | ^^^^^^^ cannot move out of borrowed content @@ -808,13 +926,13 @@ LL | &mut Either::One(_t) => (), | 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:26 + --> $DIR/dont-suggest-ref.rs:369:26 | LL | &mut Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:347:27 + --> $DIR/dont-suggest-ref.rs:377:27 | LL | let &(X(_t), X(_u)) = &(x.clone(), x.clone()); | --------------- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -824,13 +942,13 @@ LL | let &(X(_t), X(_u)) = &(x.clone(), x.clone()); | 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:347:13 + --> $DIR/dont-suggest-ref.rs:377:13 | LL | let &(X(_t), X(_u)) = &(x.clone(), x.clone()); | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:351:50 + --> $DIR/dont-suggest-ref.rs:381:50 | LL | if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } | ----------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -840,13 +958,13 @@ LL | if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { | 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:351:26 + --> $DIR/dont-suggest-ref.rs:381: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:355:53 + --> $DIR/dont-suggest-ref.rs:385:53 | LL | while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } | ----------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -856,13 +974,13 @@ LL | while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) | 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:355:29 + --> $DIR/dont-suggest-ref.rs:385: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:359:11 + --> $DIR/dont-suggest-ref.rs:389:11 | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -876,7 +994,7 @@ 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:361:23 + --> $DIR/dont-suggest-ref.rs:391:23 | LL | &(Either::One(_t), Either::Two(_u)) => (), | ^^ ^^ @@ -893,7 +1011,7 @@ LL | (Either::Two(_t), Either::One(_u)) => (), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:369:11 + --> $DIR/dont-suggest-ref.rs:399:11 | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -906,13 +1024,13 @@ LL | &(Either::One(_t), Either::Two(_u)) | 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:371:23 + --> $DIR/dont-suggest-ref.rs:401:23 | LL | &(Either::One(_t), Either::Two(_u)) | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:378:11 + --> $DIR/dont-suggest-ref.rs:408:11 | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -925,13 +1043,13 @@ LL | &(Either::One(_t), Either::Two(_u)) => (), | 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:380:23 + --> $DIR/dont-suggest-ref.rs:410:23 | LL | &(Either::One(_t), Either::Two(_u)) => (), | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:386:11 + --> $DIR/dont-suggest-ref.rs:416:11 | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -944,13 +1062,13 @@ LL | &(Either::One(_t), Either::Two(_u)) => (), | 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:388:23 + --> $DIR/dont-suggest-ref.rs:418:23 | LL | &(Either::One(_t), Either::Two(_u)) => (), | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:399:31 + --> $DIR/dont-suggest-ref.rs:429:31 | LL | let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone()); | ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -960,13 +1078,13 @@ LL | let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone()); | 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:399:17 + --> $DIR/dont-suggest-ref.rs:429: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:403:54 + --> $DIR/dont-suggest-ref.rs:433:54 | LL | if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { } | --------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -976,13 +1094,13 @@ LL | if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.c | 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:403:30 + --> $DIR/dont-suggest-ref.rs:433: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:407:57 + --> $DIR/dont-suggest-ref.rs:437:57 | LL | while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { } | --------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -992,13 +1110,13 @@ LL | while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), e | 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:407:33 + --> $DIR/dont-suggest-ref.rs:437: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:411:11 + --> $DIR/dont-suggest-ref.rs:441:11 | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -1012,7 +1130,7 @@ 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:413:27 + --> $DIR/dont-suggest-ref.rs:443:27 | LL | &mut (Either::One(_t), Either::Two(_u)) => (), | ^^ ^^ @@ -1029,7 +1147,7 @@ LL | (Either::Two(_t), Either::One(_u)) => (), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:421:11 + --> $DIR/dont-suggest-ref.rs:451:11 | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -1042,13 +1160,13 @@ LL | &mut (Either::One(_t), Either::Two(_u)) | 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:423:27 + --> $DIR/dont-suggest-ref.rs:453:27 | LL | &mut (Either::One(_t), Either::Two(_u)) | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:430:11 + --> $DIR/dont-suggest-ref.rs:460:11 | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -1061,13 +1179,13 @@ LL | &mut (Either::One(_t), Either::Two(_u)) => (), | 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:432:27 + --> $DIR/dont-suggest-ref.rs:462:27 | LL | &mut (Either::One(_t), Either::Two(_u)) => (), | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:438:11 + --> $DIR/dont-suggest-ref.rs:468:11 | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -1080,13 +1198,13 @@ LL | &mut (Either::One(_t), Either::Two(_u)) => (), | 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:440:27 + --> $DIR/dont-suggest-ref.rs:470:27 | LL | &mut (Either::One(_t), Either::Two(_u)) => (), | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:446:11 + --> $DIR/dont-suggest-ref.rs:476:11 | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -1099,7 +1217,7 @@ LL | &mut (Either::One(_t), Either::Two(_u)) => (), | 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:448:27 + --> $DIR/dont-suggest-ref.rs:478:27 | LL | &mut (Either::One(_t), Either::Two(_u)) => (), | ^^ ^^ @@ -1137,9 +1255,39 @@ LL | fn f2(&mut X(_t): &mut X) { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:394:11 + --> $DIR/dont-suggest-ref.rs:279:11 | -LL | fn f3(&(X(_t), X(_u)): &(X, X)) { } +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:279:15 + | +LL | fn f3((&X(_t),): (&X,)) { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:293: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:293:19 + | +LL | fn f4((&mut X(_t),): (&mut X,)) { } + | ^^ + +error[E0507]: cannot move out of borrowed content + --> $DIR/dont-suggest-ref.rs:424:11 + | +LL | fn f5(&(X(_t), X(_u)): &(X, X)) { } | ^^^^--^^^^^--^^ | | | | | | | ... and here @@ -1148,15 +1296,15 @@ LL | fn f3(&(X(_t), X(_u)): &(X, X)) { } | 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:394:15 + --> $DIR/dont-suggest-ref.rs:424:15 | -LL | fn f3(&(X(_t), X(_u)): &(X, X)) { } +LL | fn f5(&(X(_t), X(_u)): &(X, X)) { } | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dont-suggest-ref.rs:454:11 + --> $DIR/dont-suggest-ref.rs:484:11 | -LL | fn f4(&mut (X(_t), X(_u)): &mut (X, X)) { } +LL | fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { } | ^^^^^^^^--^^^^^--^^ | | | | | | | ... and here @@ -1165,11 +1313,11 @@ LL | fn f4(&mut (X(_t), X(_u)): &mut (X, X)) { } | 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:454:19 + --> $DIR/dont-suggest-ref.rs:484:19 | -LL | fn f4(&mut (X(_t), X(_u)): &mut (X, X)) { } +LL | fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { } | ^^ ^^ -error: aborting due to 67 previous errors +error: aborting due to 77 previous errors For more information about this error, try `rustc --explain E0507`.