diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-02-02 17:58:15 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-02-02 17:58:15 +0100 |
| commit | bd318be05dab2e1149595aacbf3d808559fa42dc (patch) | |
| tree | 9d1897caed0e56e57b6098ebab8c100ed21364d5 /src/test/ui/pattern | |
| parent | 8d4973f5871fd36b5946b9a06bd1157d4a87bbe0 (diff) | |
| download | rust-bd318be05dab2e1149595aacbf3d808559fa42dc.tar.gz rust-bd318be05dab2e1149595aacbf3d808559fa42dc.zip | |
move_ref_pattern: change pov in diagnostics & add binding names
Diffstat (limited to 'src/test/ui/pattern')
14 files changed, 457 insertions, 457 deletions
diff --git a/src/test/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.rs b/src/test/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.rs index 1cad8223826..c00296c34c4 100644 --- a/src/test/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.rs +++ b/src/test/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.rs @@ -12,7 +12,7 @@ struct X { fn main() { let x = Some(X { x: () }); match x { - Some(ref _y @ _z) => {} //~ ERROR cannot move out of `_y` because it is borrowed + Some(ref _y @ _z) => {} //~ ERROR cannot move out of value because it is borrowed None => panic!(), } @@ -26,7 +26,7 @@ fn main() { let mut x = Some(X { x: () }); match x { - Some(ref mut _y @ _z) => {} //~ ERROR cannot move out of `_y` because it is borrowed + Some(ref mut _y @ _z) => {} //~ ERROR cannot move out of value because it is borrowed None => panic!(), } diff --git a/src/test/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr b/src/test/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr index 6ad0248fc6b..026747c212a 100644 --- a/src/test/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr +++ b/src/test/ui/pattern/bindings-after-at/bind-by-move-neither-can-live-while-the-other-survives-1.stderr @@ -1,39 +1,39 @@ -error: cannot move out of `_y` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:15:14 | LL | Some(ref _y @ _z) => {} | ------^^^-- | | | - | | move out of `_y` occurs here - | borrow of `_y` occurs here + | | value moved into `_z` here + | value borrowed, by `_y`, here -error: borrow of moved value: `_z` +error: borrow of moved value --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:21:14 | LL | Some(_z @ ref _y) => {} | --^^^------ | | | | | value borrowed here after move - | value moved here + | value moved into `_z` here | move occurs because `_z` has type `X` which does implement the `Copy` trait -error: cannot move out of `_y` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:29:14 | LL | Some(ref mut _y @ _z) => {} | ----------^^^-- | | | - | | move out of `_y` occurs here - | borrow of `_y` occurs here + | | value moved into `_z` here + | value borrowed, by `_y`, here -error: borrow of moved value: `_z` +error: borrow of moved value --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:35:14 | LL | Some(_z @ ref mut _y) => {} | --^^^---------- | | | | | value borrowed here after move - | value moved here + | value moved into `_z` here | move occurs because `_z` has type `X` which does implement the `Copy` trait error[E0382]: borrow of moved value diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.rs b/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.rs index e90aeab2edb..32c638bcbcc 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.rs +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.rs @@ -34,29 +34,29 @@ fn main() { a @ box b => {} //~ ERROR use of moved value } - let ref a @ box b = Box::new(NC); //~ ERROR cannot move out of `a` because it is borrowed + let ref a @ box b = Box::new(NC); //~ ERROR cannot move out of value because it is borrowed let ref a @ box ref mut b = Box::new(nc()); - //~^ ERROR cannot borrow `a` as mutable because it is also borrowed as immutable + //~^ ERROR cannot borrow value as mutable because it is also borrowed as immutable let ref a @ box ref mut b = Box::new(NC); - //~^ ERROR cannot borrow `a` as mutable because it is also borrowed as immutable + //~^ ERROR cannot borrow value as mutable because it is also borrowed as immutable let ref a @ box ref mut b = Box::new(NC); - //~^ ERROR cannot borrow `a` as mutable because it is also borrowed as immutable + //~^ ERROR cannot borrow value as mutable because it is also borrowed as immutable *b = NC; let ref a @ box ref mut b = Box::new(NC); - //~^ ERROR cannot borrow `a` as mutable because it is also borrowed as immutable + //~^ ERROR cannot borrow value as mutable because it is also borrowed as immutable //~| ERROR cannot borrow `_` as mutable because it is also borrowed as immutable *b = NC; drop(a); let ref mut a @ box ref b = Box::new(NC); - //~^ ERROR cannot borrow `a` as immutable because it is also borrowed as mutable + //~^ ERROR cannot borrow value as immutable because it is also borrowed as mutable //~| ERROR cannot borrow `_` as immutable because it is also borrowed as mutable *a = Box::new(NC); drop(b); fn f5(ref mut a @ box ref b: Box<NC>) { - //~^ ERROR cannot borrow `a` as immutable because it is also borrowed as mutable + //~^ ERROR cannot borrow value as immutable because it is also borrowed as mutable //~| ERROR cannot borrow `_` as immutable because it is also borrowed as mutable *a = Box::new(NC); drop(b); @@ -64,7 +64,7 @@ fn main() { match Box::new(nc()) { ref mut a @ box ref b => { - //~^ ERROR cannot borrow `a` as immutable because it is also borrowed as mutable + //~^ ERROR cannot borrow value as immutable because it is also borrowed as mutable //~| ERROR cannot borrow `_` as immutable because it is also borrowed as mutable *a = Box::new(NC); drop(b); diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr index 50185c1a017..5534d0a75e6 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-at-and-box.stderr @@ -1,74 +1,74 @@ -error: cannot move out of `a` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-at-and-box.rs:37:9 | LL | let ref a @ box b = Box::new(NC); | -----^^^^^^^- | | | - | | move out of `a` occurs here - | borrow of `a` occurs here + | | value moved into `b` here + | value borrowed, by `a`, here -error: cannot borrow `a` as mutable because it is also borrowed as immutable +error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-at-and-box.rs:39:9 | LL | let ref a @ box ref mut b = Box::new(nc()); | -----^^^^^^^--------- | | | - | | mutable borrow occurs here - | immutable borrow occurs here + | | mutable borrow, by `b`, occurs here + | immutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable because it is also borrowed as immutable +error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-at-and-box.rs:41:9 | LL | let ref a @ box ref mut b = Box::new(NC); | -----^^^^^^^--------- | | | - | | mutable borrow occurs here - | immutable borrow occurs here + | | mutable borrow, by `b`, occurs here + | immutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable because it is also borrowed as immutable +error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-at-and-box.rs:43:9 | LL | let ref a @ box ref mut b = Box::new(NC); | -----^^^^^^^--------- | | | - | | mutable borrow occurs here - | immutable borrow occurs here + | | mutable borrow, by `b`, occurs here + | immutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable because it is also borrowed as immutable +error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-at-and-box.rs:46:9 | LL | let ref a @ box ref mut b = Box::new(NC); | -----^^^^^^^--------- | | | - | | mutable borrow occurs here - | immutable borrow occurs here + | | mutable borrow, by `b`, occurs here + | immutable borrow, by `a`, occurs here -error: cannot borrow `a` as immutable because it is also borrowed as mutable +error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-at-and-box.rs:52:9 | LL | let ref mut a @ box ref b = Box::new(NC); | ---------^^^^^^^----- | | | - | | immutable borrow occurs here - | mutable borrow occurs here + | | immutable borrow, by `b`, occurs here + | mutable borrow, by `a`, occurs here -error: cannot borrow `a` as immutable because it is also borrowed as mutable +error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-at-and-box.rs:66:9 | LL | ref mut a @ box ref b => { | ---------^^^^^^^----- | | | - | | immutable borrow occurs here - | mutable borrow occurs here + | | immutable borrow, by `b`, occurs here + | mutable borrow, by `a`, occurs here -error: cannot borrow `a` as immutable because it is also borrowed as mutable +error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-at-and-box.rs:58:11 | LL | fn f5(ref mut a @ box ref b: Box<NC>) { | ---------^^^^^^^----- | | | - | | immutable borrow occurs here - | mutable borrow occurs here + | | immutable borrow, by `b`, occurs here + | mutable borrow, by `a`, occurs here error[E0382]: use of moved value --> $DIR/borrowck-pat-at-and-box.rs:21:18 diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse-promotion.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse-promotion.stderr index dc9201d0d06..91fdfd4f2ab 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse-promotion.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse-promotion.stderr @@ -1,11 +1,11 @@ -error: borrow of moved value: `a` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse-promotion.rs:9:9 | LL | let a @ ref b = U; | -^^^----- | | | | | value borrowed here after move - | value moved here + | value moved into `a` here | move occurs because `a` has type `main::U` which does implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr index 0c502cee7f6..ec86692dc69 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref-inverse.stderr @@ -1,14 +1,14 @@ -error: borrow of moved value: `a` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:29:9 | LL | let a @ ref b = U; | -^^^----- | | | | | value borrowed here after move - | value moved here + | value moved into `a` here | move occurs because `a` has type `main::U` which does implement the `Copy` trait -error: borrow of moved value: `a` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:31:9 | LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U); @@ -16,30 +16,30 @@ LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U); | | | | | | | value borrowed here after move | | value borrowed here after move - | value moved here + | value moved into `a` here | move occurs because `a` has type `(main::U, main::U)` which does implement the `Copy` trait -error: borrow of moved value: `b` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:31:14 | LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U); | -----^^^--------- | | | | | value borrowed here after move - | value moved here + | value moved into `b` here | move occurs because `b` has type `main::U` which does implement the `Copy` trait -error: borrow of moved value: `d` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:31:33 | LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U); | -^^^----- | | | | | value borrowed here after move - | value moved here + | value moved into `d` here | move occurs because `d` has type `main::U` which does implement the `Copy` trait -error: borrow of moved value: `a` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:38:9 | LL | let a @ [ref mut b, ref c] = [U, U]; @@ -47,20 +47,20 @@ LL | let a @ [ref mut b, ref c] = [U, U]; | | | | | | | value borrowed here after move | | value borrowed here after move - | value moved here + | value moved into `a` here | move occurs because `a` has type `[main::U; 2]` which does implement the `Copy` trait -error: borrow of moved value: `a` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:41:9 | LL | let a @ ref b = u(); | -^^^----- | | | | | value borrowed here after move - | value moved here + | value moved into `a` here | move occurs because `a` has type `main::U` which does implement the `Copy` trait -error: borrow of moved value: `a` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:44:9 | LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u()); @@ -68,30 +68,30 @@ LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u()); | | | | | | | value borrowed here after move | | value borrowed here after move - | value moved here + | value moved into `a` here | move occurs because `a` has type `(main::U, main::U)` which does implement the `Copy` trait -error: borrow of moved value: `b` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:44:14 | LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u()); | -----^^^--------- | | | | | value borrowed here after move - | value moved here + | value moved into `b` here | move occurs because `b` has type `main::U` which does implement the `Copy` trait -error: borrow of moved value: `d` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:44:33 | LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u()); | -^^^----- | | | | | value borrowed here after move - | value moved here + | value moved into `d` here | move occurs because `d` has type `main::U` which does implement the `Copy` trait -error: borrow of moved value: `a` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:51:9 | LL | let a @ [ref mut b, ref c] = [u(), u()]; @@ -99,20 +99,20 @@ LL | let a @ [ref mut b, ref c] = [u(), u()]; | | | | | | | value borrowed here after move | | value borrowed here after move - | value moved here + | value moved into `a` here | move occurs because `a` has type `[main::U; 2]` which does implement the `Copy` trait -error: borrow of moved value: `a` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:56:9 | LL | a @ Some(ref b) => {} | -^^^^^^^^-----^ | | | | | value borrowed here after move - | value moved here + | value moved into `a` here | move occurs because `a` has type `std::option::Option<main::U>` which does implement the `Copy` trait -error: borrow of moved value: `a` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:61:9 | LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} @@ -120,30 +120,30 @@ LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} | | | | | | | value borrowed here after move | | value borrowed here after move - | value moved here + | value moved into `a` here | move occurs because `a` has type `std::option::Option<(main::U, main::U)>` which does implement the `Copy` trait -error: borrow of moved value: `b` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:61:19 | LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} | -----^^^--------- | | | | | value borrowed here after move - | value moved here + | value moved into `b` here | move occurs because `b` has type `main::U` which does implement the `Copy` trait -error: borrow of moved value: `d` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:61:38 | LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} | -^^^----- | | | | | value borrowed here after move - | value moved here + | value moved into `d` here | move occurs because `d` has type `main::U` which does implement the `Copy` trait -error: borrow of moved value: `a` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:71:9 | LL | mut a @ Some([ref b, ref mut c]) => {} @@ -151,20 +151,20 @@ LL | mut a @ Some([ref b, ref mut c]) => {} | | | | | | | value borrowed here after move | | value borrowed here after move - | value moved here + | value moved into `a` here | move occurs because `a` has type `std::option::Option<[main::U; 2]>` which does implement the `Copy` trait -error: borrow of moved value: `a` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:77:9 | LL | a @ Some(ref b) => {} | -^^^^^^^^-----^ | | | | | value borrowed here after move - | value moved here + | value moved into `a` here | move occurs because `a` has type `std::option::Option<main::U>` which does implement the `Copy` trait -error: borrow of moved value: `a` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:83:9 | LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} @@ -172,30 +172,30 @@ LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} | | | | | | | value borrowed here after move | | value borrowed here after move - | value moved here + | value moved into `a` here | move occurs because `a` has type `std::option::Option<(main::U, main::U)>` which does implement the `Copy` trait -error: borrow of moved value: `b` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:83:19 | LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} | -----^^^--------- | | | | | value borrowed here after move - | value moved here + | value moved into `b` here | move occurs because `b` has type `main::U` which does implement the `Copy` trait -error: borrow of moved value: `d` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:83:38 | LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} | -^^^----- | | | | | value borrowed here after move - | value moved here + | value moved into `d` here | move occurs because `d` has type `main::U` which does implement the `Copy` trait -error: borrow of moved value: `a` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:93:9 | LL | mut a @ Some([ref b, ref mut c]) => {} @@ -203,20 +203,20 @@ LL | mut a @ Some([ref b, ref mut c]) => {} | | | | | | | value borrowed here after move | | value borrowed here after move - | value moved here + | value moved into `a` here | move occurs because `a` has type `std::option::Option<[main::U; 2]>` which does implement the `Copy` trait -error: borrow of moved value: `a` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:14:11 | LL | fn f1(a @ ref b: U) {} | -^^^----- | | | | | value borrowed here after move - | value moved here + | value moved into `a` here | move occurs because `a` has type `main::U` which does implement the `Copy` trait -error: borrow of moved value: `a` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:18:11 | LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {} @@ -224,30 +224,30 @@ LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {} | | | | | | | value borrowed here after move | | value borrowed here after move - | value moved here + | value moved into `a` here | move occurs because `a` has type `(main::U, main::U)` which does implement the `Copy` trait -error: borrow of moved value: `b` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:18:20 | LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {} | -^^^----- | | | | | value borrowed here after move - | value moved here + | value moved into `b` here | move occurs because `b` has type `main::U` which does implement the `Copy` trait -error: borrow of moved value: `d` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:18:31 | LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {} | -----^^^----- | | | | | value borrowed here after move - | value moved here + | value moved into `d` here | move occurs because `d` has type `main::U` which does implement the `Copy` trait -error: borrow of moved value: `a` +error: borrow of moved value --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:25:11 | LL | fn f3(a @ [ref mut b, ref c]: [U; 2]) {} @@ -255,7 +255,7 @@ LL | fn f3(a @ [ref mut b, ref c]: [U; 2]) {} | | | | | | | value borrowed here after move | | value borrowed here after move - | value moved here + | value moved into `a` here | move occurs because `a` has type `[main::U; 2]` which does implement the `Copy` trait error[E0382]: borrow of moved value diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.rs b/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.rs index 4ece55b07b0..b7c8c8766c0 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.rs +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.rs @@ -12,63 +12,63 @@ fn main() { } fn f1(ref a @ b: U) {} - //~^ ERROR cannot move out of `a` because it is borrowed + //~^ ERROR cannot move out of value because it is borrowed fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {} - //~^ ERROR cannot move out of `a` because it is borrowed - //~| ERROR cannot move out of `b` because it is borrowed - //~| ERROR cannot move out of `d` because it is borrowed + //~^ ERROR cannot move out of value because it is borrowed + //~| ERROR cannot move out of value because it is borrowed + //~| ERROR cannot move out of value because it is borrowed fn f3(ref mut a @ [b, mut c]: [U; 2]) {} - //~^ ERROR cannot move out of `a` because it is borrowed + //~^ ERROR cannot move out of value because it is borrowed let ref a @ b = U; - //~^ ERROR cannot move out of `a` because it is borrowed + //~^ ERROR cannot move out of value because it is borrowed let ref a @ (ref b @ mut c, ref d @ e) = (U, U); - //~^ ERROR cannot move out of `a` because it is borrowed - //~| ERROR cannot move out of `b` because it is borrowed - //~| ERROR cannot move out of `d` because it is borrowed + //~^ ERROR cannot move out of value because it is borrowed + //~| ERROR cannot move out of value because it is borrowed + //~| ERROR cannot move out of value because it is borrowed let ref mut a @ [b, mut c] = [U, U]; - //~^ ERROR cannot move out of `a` because it is borrowed + //~^ ERROR cannot move out of value because it is borrowed let ref a @ b = u(); - //~^ ERROR cannot move out of `a` because it is borrowed + //~^ ERROR cannot move out of value because it is borrowed let ref a @ (ref b @ mut c, ref d @ e) = (u(), u()); - //~^ ERROR cannot move out of `a` because it is borrowed - //~| ERROR cannot move out of `b` because it is borrowed - //~| ERROR cannot move out of `d` because it is borrowed + //~^ ERROR cannot move out of value because it is borrowed + //~| ERROR cannot move out of value because it is borrowed + //~| ERROR cannot move out of value because it is borrowed let ref mut a @ [b, mut c] = [u(), u()]; - //~^ ERROR cannot move out of `a` because it is borrowed + //~^ ERROR cannot move out of value because it is borrowed match Some(U) { ref a @ Some(b) => {} - //~^ ERROR cannot move out of `a` because it is borrowed + //~^ ERROR cannot move out of value because it is borrowed None => {} } match Some((U, U)) { ref a @ Some((ref b @ mut c, ref d @ e)) => {} - //~^ ERROR cannot move out of `a` because it is borrowed - //~| ERROR cannot move out of `b` because it is borrowed - //~| ERROR cannot move out of `d` because it is borrowed + //~^ ERROR cannot move out of value because it is borrowed + //~| ERROR cannot move out of value because it is borrowed + //~| ERROR cannot move out of value because it is borrowed None => {} } match Some([U, U]) { ref mut a @ Some([b, mut c]) => {} - //~^ ERROR cannot move out of `a` because it is borrowed + //~^ ERROR cannot move out of value because it is borrowed None => {} } match Some(u()) { ref a @ Some(b) => {} - //~^ ERROR cannot move out of `a` because it is borrowed + //~^ ERROR cannot move out of value because it is borrowed None => {} } match Some((u(), u())) { ref a @ Some((ref b @ mut c, ref d @ e)) => {} - //~^ ERROR cannot move out of `a` because it is borrowed - //~| ERROR cannot move out of `b` because it is borrowed - //~| ERROR cannot move out of `d` because it is borrowed + //~^ ERROR cannot move out of value because it is borrowed + //~| ERROR cannot move out of value because it is borrowed + //~| ERROR cannot move out of value because it is borrowed None => {} } match Some([u(), u()]) { ref mut a @ Some([b, mut c]) => {} - //~^ ERROR cannot move out of `a` because it is borrowed + //~^ ERROR cannot move out of value because it is borrowed None => {} } } diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr index 607bbd5f991..e5419efa00b 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-by-move-and-ref.stderr @@ -1,237 +1,237 @@ -error: cannot move out of `a` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:23:9 | LL | let ref a @ b = U; | -----^^^- | | | - | | move out of `a` occurs here - | borrow of `a` occurs here + | | value moved into `b` here + | value borrowed, by `a`, here -error: cannot move out of `a` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:25:9 | LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U); | -----^^^^^^^^^^^^-----^^^^^^^^^^-^ | | | | - | | | move out of `a` occurs here - | | move out of `a` occurs here - | borrow of `a` occurs here + | | | value moved into `e` here + | | value moved into `c` here + | value borrowed, by `a`, here -error: cannot move out of `b` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:25:18 | LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U); | -----^^^----- | | | - | | move out of `b` occurs here - | borrow of `b` occurs here + | | value moved into `c` here + | value borrowed, by `b`, here -error: cannot move out of `d` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:25:33 | LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U); | -----^^^- | | | - | | move out of `d` occurs here - | borrow of `d` occurs here + | | value moved into `e` here + | value borrowed, by `d`, here -error: cannot move out of `a` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:29:9 | LL | let ref mut a @ [b, mut c] = [U, U]; | ---------^^^^-^^-----^ | | | | - | | | move out of `a` occurs here - | | move out of `a` occurs here - | borrow of `a` occurs here + | | | value moved into `c` here + | | value moved into `b` here + | value borrowed, by `a`, here -error: cannot move out of `a` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:31:9 | LL | let ref a @ b = u(); | -----^^^- | | | - | | move out of `a` occurs here - | borrow of `a` occurs here + | | value moved into `b` here + | value borrowed, by `a`, here -error: cannot move out of `a` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:33:9 | LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u()); | -----^^^^^^^^^^^^-----^^^^^^^^^^-^ | | | | - | | | move out of `a` occurs here - | | move out of `a` occurs here - | borrow of `a` occurs here + | | | value moved into `e` here + | | value moved into `c` here + | value borrowed, by `a`, here -error: cannot move out of `b` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:33:18 | LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u()); | -----^^^----- | | | - | | move out of `b` occurs here - | borrow of `b` occurs here + | | value moved into `c` here + | value borrowed, by `b`, here -error: cannot move out of `d` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:33:33 | LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u()); | -----^^^- | | | - | | move out of `d` occurs here - | borrow of `d` occurs here + | | value moved into `e` here + | value borrowed, by `d`, here -error: cannot move out of `a` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:37:9 | LL | let ref mut a @ [b, mut c] = [u(), u()]; | ---------^^^^-^^-----^ | | | | - | | | move out of `a` occurs here - | | move out of `a` occurs here - | borrow of `a` occurs here + | | | value moved into `c` here + | | value moved into `b` here + | value borrowed, by `a`, here -error: cannot move out of `a` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:41:9 | LL | ref a @ Some(b) => {} | -----^^^^^^^^-^ | | | - | | move out of `a` occurs here - | borrow of `a` occurs here + | | value moved into `b` here + | value borrowed, by `a`, here -error: cannot move out of `a` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:46:9 | LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} | -----^^^^^^^^^^^^^^^^^-----^^^^^^^^^^-^^ | | | | - | | | move out of `a` occurs here - | | move out of `a` occurs here - | borrow of `a` occurs here + | | | value moved into `e` here + | | value moved into `c` here + | value borrowed, by `a`, here -error: cannot move out of `b` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:46:23 | LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} | -----^^^----- | | | - | | move out of `b` occurs here - | borrow of `b` occurs here + | | value moved into `c` here + | value borrowed, by `b`, here -error: cannot move out of `d` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:46:38 | LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} | -----^^^- | | | - | | move out of `d` occurs here - | borrow of `d` occurs here + | | value moved into `e` here + | value borrowed, by `d`, here -error: cannot move out of `a` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:53:9 | LL | ref mut a @ Some([b, mut c]) => {} | ---------^^^^^^^^^-^^-----^^ | | | | - | | | move out of `a` occurs here - | | move out of `a` occurs here - | borrow of `a` occurs here + | | | value moved into `c` here + | | value moved into `b` here + | value borrowed, by `a`, here -error: cannot move out of `a` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:58:9 | LL | ref a @ Some(b) => {} | -----^^^^^^^^-^ | | | - | | move out of `a` occurs here - | borrow of `a` occurs here + | | value moved into `b` here + | value borrowed, by `a`, here -error: cannot move out of `a` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:63:9 | LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} | -----^^^^^^^^^^^^^^^^^-----^^^^^^^^^^-^^ | | | | - | | | move out of `a` occurs here - | | move out of `a` occurs here - | borrow of `a` occurs here + | | | value moved into `e` here + | | value moved into `c` here + | value borrowed, by `a`, here -error: cannot move out of `b` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:63:23 | LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} | -----^^^----- | | | - | | move out of `b` occurs here - | borrow of `b` occurs here + | | value moved into `c` here + | value borrowed, by `b`, here -error: cannot move out of `d` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:63:38 | LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} | -----^^^- | | | - | | move out of `d` occurs here - | borrow of `d` occurs here + | | value moved into `e` here + | value borrowed, by `d`, here -error: cannot move out of `a` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:70:9 | LL | ref mut a @ Some([b, mut c]) => {} | ---------^^^^^^^^^-^^-----^^ | | | | - | | | move out of `a` occurs here - | | move out of `a` occurs here - | borrow of `a` occurs here + | | | value moved into `c` here + | | value moved into `b` here + | value borrowed, by `a`, here -error: cannot move out of `a` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:14:11 | LL | fn f1(ref a @ b: U) {} | -----^^^- | | | - | | move out of `a` occurs here - | borrow of `a` occurs here + | | value moved into `b` here + | value borrowed, by `a`, here -error: cannot move out of `a` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:16:11 | LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {} | -----^^^^^^^^^^^^-----^^^^^^^^^^-^ | | | | - | | | move out of `a` occurs here - | | move out of `a` occurs here - | borrow of `a` occurs here + | | | value moved into `e` here + | | value moved into `c` here + | value borrowed, by `a`, here -error: cannot move out of `b` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:16:20 | LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {} | -----^^^----- | | | - | | move out of `b` occurs here - | borrow of `b` occurs here + | | value moved into `c` here + | value borrowed, by `b`, here -error: cannot move out of `d` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:16:35 | LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {} | -----^^^- | | | - | | move out of `d` occurs here - | borrow of `d` occurs here + | | value moved into `e` here + | value borrowed, by `d`, here -error: cannot move out of `a` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-by-move-and-ref.rs:20:11 | LL | fn f3(ref mut a @ [b, mut c]: [U; 2]) {} | ---------^^^^-^^-----^ | | | | - | | | move out of `a` occurs here - | | move out of `a` occurs here - | borrow of `a` occurs here + | | | value moved into `c` here + | | value moved into `b` here + | value borrowed, by `a`, here error: aborting due to 25 previous errors diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.rs b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.rs index a921ad056d8..58d4a9b018c 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.rs +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.rs @@ -9,7 +9,7 @@ enum Option<T> { fn main() { match &mut Some(1) { ref mut z @ &mut Some(ref a) => { - //~^ ERROR cannot borrow `z` as immutable because it is also borrowed as mutable + //~^ ERROR cannot borrow value as immutable because it is also borrowed as mutable //~| ERROR cannot borrow `_` as immutable because it is also borrowed as mutable **z = None; println!("{}", *a); @@ -23,52 +23,52 @@ fn main() { fn u() -> U { U } fn f1(ref a @ ref mut b: U) {} - //~^ ERROR cannot borrow `a` as mutable because it is also borrowed as immutable + //~^ ERROR cannot borrow value as mutable because it is also borrowed as immutable fn f2(ref mut a @ ref b: U) {} - //~^ ERROR cannot borrow `a` as immutable because it is also borrowed as mutable + //~^ ERROR cannot borrow value as immutable because it is also borrowed as mutable fn f3(ref a @ [ref b, ref mut mid @ .., ref c]: [U; 4]) {} - //~^ ERROR cannot borrow `a` as mutable because it is also borrowed as immutable + //~^ ERROR cannot borrow value as mutable because it is also borrowed as immutable fn f4_also_moved(ref a @ ref mut b @ c: U) {} - //~^ ERROR cannot borrow `a` as mutable because it is also borrowed as immutable - //~| ERROR cannot move out of `b` because it is borrowed + //~^ ERROR cannot borrow value as mutable because it is also borrowed as immutable + //~| ERROR cannot move out of value because it is borrowed let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub - //~^ ERROR cannot borrow `a` as mutable more than once at a time - //~| ERROR cannot borrow `b` as mutable because it is also borrowed as immutable + //~^ ERROR cannot borrow value as mutable more than once at a time + //~| ERROR cannot borrow value as mutable because it is also borrowed as immutable let ref a @ ref mut b = U; - //~^ ERROR cannot borrow `a` as mutable because it is also borrowed as immutable + //~^ ERROR cannot borrow value as mutable because it is also borrowed as immutable let ref mut a @ ref b = U; - //~^ ERROR cannot borrow `a` as immutable because it is also borrowed as mutable + //~^ ERROR cannot borrow value as immutable because it is also borrowed as mutable let ref a @ (ref mut b, ref mut c) = (U, U); - //~^ ERROR cannot borrow `a` as mutable because it is also borrowed as immutable + //~^ ERROR cannot borrow value as mutable because it is also borrowed as immutable let ref mut a @ (ref b, ref c) = (U, U); - //~^ ERROR cannot borrow `a` as immutable because it is also borrowed as mutable + //~^ ERROR cannot borrow value as immutable because it is also borrowed as mutable let ref mut a @ ref b = u(); - //~^ ERROR cannot borrow `a` as immutable because it is also borrowed as mutable + //~^ ERROR cannot borrow value as immutable because it is also borrowed as mutable //~| ERROR cannot borrow `_` as immutable because it is also borrowed as mutable *a = u(); drop(b); let ref a @ ref mut b = u(); - //~^ ERROR cannot borrow `a` as mutable because it is also borrowed as immutable + //~^ ERROR cannot borrow value as mutable because it is also borrowed as immutable //~| ERROR cannot borrow `_` as mutable because it is also borrowed as immutable *b = u(); drop(a); let ref mut a @ ref b = U; - //~^ ERROR cannot borrow `a` as immutable because it is also borrowed as mutable + //~^ ERROR cannot borrow value as immutable because it is also borrowed as mutable *a = U; drop(b); let ref a @ ref mut b = U; - //~^ ERROR cannot borrow `a` as mutable because it is also borrowed as immutable + //~^ ERROR cannot borrow value as mutable because it is also borrowed as immutable *b = U; drop(a); match Ok(U) { ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => { - //~^ ERROR cannot borrow `a` as immutable because it is also borrowed as mutable - //~| ERROR cannot borrow `a` as immutable because it is also borrowed as mutable + //~^ ERROR cannot borrow value as immutable because it is also borrowed as mutable + //~| ERROR cannot borrow value as immutable because it is also borrowed as mutable *a = Err(U); drop(b); } @@ -76,8 +76,8 @@ fn main() { match Ok(U) { ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { - //~^ ERROR cannot borrow `a` as mutable because it is also borrowed as immutable - //~| ERROR cannot borrow `a` as mutable because it is also borrowed as immutable + //~^ ERROR cannot borrow value as mutable because it is also borrowed as immutable + //~| ERROR cannot borrow value as mutable because it is also borrowed as immutable //~| ERROR cannot borrow `_` as mutable because it is also borrowed as immutable //~| ERROR cannot borrow `_` as mutable because it is also borrowed as immutable *b = U; @@ -87,52 +87,52 @@ fn main() { match Ok(U) { ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {} - //~^ ERROR cannot borrow `a` as mutable because it is also borrowed as immutable - //~| ERROR cannot borrow `a` as mutable because it is also borrowed as immutable + //~^ ERROR cannot borrow value as mutable because it is also borrowed as immutable + //~| ERROR cannot borrow value as mutable because it is also borrowed as immutable //~| ERROR cannot assign to `*b`, as it is immutable for the pattern guard _ => {} } match Ok(U) { ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {} - //~^ ERROR cannot borrow `a` as immutable because it is also borrowed as mutable - //~| ERROR cannot borrow `a` as immutable because it is also borrowed as mutable + //~^ ERROR cannot borrow value as immutable because it is also borrowed as mutable + //~| ERROR cannot borrow value as immutable because it is also borrowed as mutable //~| ERROR cannot assign to `*a`, as it is immutable for the pattern guard _ => {} } match Ok(U) { ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {} - //~^ ERROR cannot borrow `a` as mutable because it is also borrowed as immutable - //~| ERROR cannot borrow `a` as mutable because it is also borrowed as immutable + //~^ ERROR cannot borrow value as mutable because it is also borrowed as immutable + //~| ERROR cannot borrow value as mutable because it is also borrowed as immutable //~| ERROR cannot move out of `b` in pattern guard //~| ERROR cannot move out of `b` in pattern guard _ => {} } match Ok(U) { ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} - //~^ ERROR cannot borrow `a` as immutable because it is also borrowed as mutable - //~| ERROR cannot borrow `a` as immutable because it is also borrowed as mutable + //~^ ERROR cannot borrow value as immutable because it is also borrowed as mutable + //~| ERROR cannot borrow value as immutable because it is also borrowed as mutable //~| ERROR cannot move out of `a` in pattern guard //~| ERROR cannot move out of `a` in pattern guard _ => {} } let ref a @ (ref mut b, ref mut c) = (U, U); - //~^ ERROR cannot borrow `a` as mutable because it is also borrowed as immutable + //~^ ERROR cannot borrow value as mutable because it is also borrowed as immutable *b = U; *c = U; let ref a @ (ref mut b, ref mut c) = (U, U); - //~^ ERROR cannot borrow `a` as mutable because it is also borrowed as immutable + //~^ ERROR cannot borrow value as mutable because it is also borrowed as immutable //~| ERROR cannot borrow `_` as mutable because it is also borrowed as immutable //~| ERROR cannot borrow `_` as mutable because it is also borrowed as immutable *b = U; drop(a); let ref a @ (ref mut b, ref mut c) = (U, U); - //~^ ERROR cannot borrow `a` as mutable because it is also borrowed as immutable + //~^ ERROR cannot borrow value as mutable because it is also borrowed as immutable *b = U; //~| ERROR cannot borrow `_` as mutable because it is also borrowed as immutable *c = U; //~| ERROR cannot borrow `_` as mutable because it is also borrowed as immutable drop(a); let ref mut a @ (ref b, ref c) = (U, U); - //~^ ERROR cannot borrow `a` as immutable because it is also borrowed as mutable + //~^ ERROR cannot borrow value as immutable because it is also borrowed as mutable } diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr index 4652fffe36a..8c6ca888e07 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr @@ -1,298 +1,298 @@ -error: cannot borrow `z` as immutable because it is also borrowed as mutable +error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:11:9 | LL | ref mut z @ &mut Some(ref a) => { | ---------^^^^^^^^^^^^^-----^ | | | - | | immutable borrow occurs here - | mutable borrow occurs here + | | immutable borrow, by `a`, occurs here + | mutable borrow, by `z`, occurs here -error: cannot borrow `a` as mutable more than once at a time +error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-and-ref.rs:35:9 | LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub | ---------^^^^-----------------^ | | | | - | | | another mutable borrow occurs here - | | also borrowed as immutable here - | first mutable borrow occurs here + | | | another mutable borrow, by `c`, occurs here + | | also borrowed as immutable, by `b`, here + | first mutable borrow, by `a`, occurs here -error: cannot borrow `b` as mutable because it is also borrowed as immutable +error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:35:22 | LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub | -----^^^--------- | | | - | | mutable borrow occurs here - | immutable borrow occurs here + | | mutable borrow, by `c`, occurs here + | immutable borrow, by `b`, occurs here -error: cannot borrow `a` as mutable because it is also borrowed as immutable +error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:39:9 | LL | let ref a @ ref mut b = U; | -----^^^--------- | | | - | | mutable borrow occurs here - | immutable borrow occurs here + | | mutable borrow, by `b`, occurs here + | immutable borrow, by `a`, occurs here -error: cannot borrow `a` as immutable because it is also borrowed as mutable +error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:41:9 | LL | let ref mut a @ ref b = U; | ---------^^^----- | | | - | | immutable borrow occurs here - | mutable borrow occurs here + | | immutable borrow, by `b`, occurs here + | mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable because it is also borrowed as immutable +error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:43:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); | -----^^^^---------^^---------^ | | | | - | | | mutable borrow occurs here - | | mutable borrow occurs here - | immutable borrow occurs here + | | | mutable borrow, by `c`, occurs here + | | mutable borrow, by `b`, occurs here + | immutable borrow, by `a`, occurs here -error: cannot borrow `a` as immutable because it is also borrowed as mutable +error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:45:9 | LL | let ref mut a @ (ref b, ref c) = (U, U); | ---------^^^^-----^^-----^ | | | | - | | | immutable borrow occurs here - | | immutable borrow occurs here - | mutable borrow occurs here + | | | immutable borrow, by `c`, occurs here + | | immutable borrow, by `b`, occurs here + | mutable borrow, by `a`, occurs here -error: cannot borrow `a` as immutable because it is also borrowed as mutable +error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:48:9 | LL | let ref mut a @ ref b = u(); | ---------^^^----- | | | - | | immutable borrow occurs here - | mutable borrow occurs here + | | immutable borrow, by `b`, occurs here + | mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable because it is also borrowed as immutable +error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:53:9 | LL | let ref a @ ref mut b = u(); | -----^^^--------- | | | - | | mutable borrow occurs here - | immutable borrow occurs here + | | mutable borrow, by `b`, occurs here + | immutable borrow, by `a`, occurs here -error: cannot borrow `a` as immutable because it is also borrowed as mutable +error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:59:9 | LL | let ref mut a @ ref b = U; | ---------^^^----- | | | - | | immutable borrow occurs here - | mutable borrow occurs here + | | immutable borrow, by `b`, occurs here + | mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable because it is also borrowed as immutable +error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:63:9 | LL | let ref a @ ref mut b = U; | -----^^^--------- | | | - | | mutable borrow occurs here - | immutable borrow occurs here + | | mutable borrow, by `b`, occurs here + | immutable borrow, by `a`, occurs here -error: cannot borrow `a` as immutable because it is also borrowed as mutable +error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:69:9 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => { | ---------^^^^^^-----^ | | | - | | immutable borrow occurs here - | mutable borrow occurs here + | | immutable borrow, by `b`, occurs here + | mutable borrow, by `a`, occurs here -error: cannot borrow `a` as immutable because it is also borrowed as mutable +error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:69:33 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => { | ---------^^^^^^^-----^ | | | - | | immutable borrow occurs here - | mutable borrow occurs here + | | immutable borrow, by `b`, occurs here + | mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable because it is also borrowed as immutable +error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:78:9 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { | -----^^^^^^---------^ | | | - | | mutable borrow occurs here - | immutable borrow occurs here + | | mutable borrow, by `b`, occurs here + | immutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable because it is also borrowed as immutable +error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:78:33 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { | -----^^^^^^^---------^ | | | - | | mutable borrow occurs here - | immutable borrow occurs here + | | mutable borrow, by `b`, occurs here + | immutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable because it is also borrowed as immutable +error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:89:9 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {} | -----^^^^^^---------^ | | | - | | mutable borrow occurs here - | immutable borrow occurs here + | | mutable borrow, by `b`, occurs here + | immutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable because it is also borrowed as immutable +error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:89:33 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {} | -----^^^^^^^---------^ | | | - | | mutable borrow occurs here - | immutable borrow occurs here + | | mutable borrow, by `b`, occurs here + | immutable borrow, by `a`, occurs here -error: cannot borrow `a` as immutable because it is also borrowed as mutable +error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:96:9 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {} | ---------^^^^^^-----^ | | | - | | immutable borrow occurs here - | mutable borrow occurs here + | | immutable borrow, by `b`, occurs here + | mutable borrow, by `a`, occurs here -error: cannot borrow `a` as immutable because it is also borrowed as mutable +error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:96:33 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {} | ---------^^^^^^^-----^ | | | - | | immutable borrow occurs here - | mutable borrow occurs here + | | immutable borrow, by `b`, occurs here + | mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable because it is also borrowed as immutable +error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:103:9 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {} | -----^^^^^^---------^ | | | - | | mutable borrow occurs here - | immutable borrow occurs here + | | mutable borrow, by `b`, occurs here + | immutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable because it is also borrowed as immutable +error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:103:33 | LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {} | -----^^^^^^^---------^ | | | - | | mutable borrow occurs here - | immutable borrow occurs here + | | mutable borrow, by `b`, occurs here + | immutable borrow, by `a`, occurs here -error: cannot borrow `a` as immutable because it is also borrowed as mutable +error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:111:9 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} | ---------^^^^^^-----^ | | | - | | immutable borrow occurs here - | mutable borrow occurs here + | | immutable borrow, by `b`, occurs here + | mutable borrow, by `a`, occurs here -error: cannot borrow `a` as immutable because it is also borrowed as mutable +error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:111:33 | LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} | ---------^^^^^^^-----^ | | | - | | immutable borrow occurs here - | mutable borrow occurs here + | | immutable borrow, by `b`, occurs here + | mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable because it is also borrowed as immutable +error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:119:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); | -----^^^^---------^^---------^ | | | | - | | | mutable borrow occurs here - | | mutable borrow occurs here - | immutable borrow occurs here + | | | mutable borrow, by `c`, occurs here + | | mutable borrow, by `b`, occurs here + | immutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable because it is also borrowed as immutable +error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:124:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); | -----^^^^---------^^---------^ | | | | - | | | mutable borrow occurs here - | | mutable borrow occurs here - | immutable borrow occurs here + | | | mutable borrow, by `c`, occurs here + | | mutable borrow, by `b`, occurs here + | immutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable because it is also borrowed as immutable +error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:131:9 | LL | let ref a @ (ref mut b, ref mut c) = (U, U); | -----^^^^---------^^---------^ | | | | - | | | mutable borrow occurs here - | | mutable borrow occurs here - | immutable borrow occurs here + | | | mutable borrow, by `c`, occurs here + | | mutable borrow, by `b`, occurs here + | immutable borrow, by `a`, occurs here -error: cannot borrow `a` as immutable because it is also borrowed as mutable +error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:136:9 | LL | let ref mut a @ (ref b, ref c) = (U, U); | ---------^^^^-----^^-----^ | | | | - | | | immutable borrow occurs here - | | immutable borrow occurs here - | mutable borrow occurs here + | | | immutable borrow, by `c`, occurs here + | | immutable borrow, by `b`, occurs here + | mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable because it is also borrowed as immutable +error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:25:11 | LL | fn f1(ref a @ ref mut b: U) {} | -----^^^--------- | | | - | | mutable borrow occurs here - | immutable borrow occurs here + | | mutable borrow, by `b`, occurs here + | immutable borrow, by `a`, occurs here -error: cannot borrow `a` as immutable because it is also borrowed as mutable +error: cannot borrow value as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:27:11 | LL | fn f2(ref mut a @ ref b: U) {} | ---------^^^----- | | | - | | immutable borrow occurs here - | mutable borrow occurs here + | | immutable borrow, by `b`, occurs here + | mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable because it is also borrowed as immutable +error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:29:11 | LL | fn f3(ref a @ [ref b, ref mut mid @ .., ref c]: [U; 4]) {} | -----^^^^^^^^^^^----------------^^^^^^^^ | | | - | | mutable borrow occurs here - | immutable borrow occurs here + | | mutable borrow, by `mid`, occurs here + | immutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable because it is also borrowed as immutable +error: cannot borrow value as mutable because it is also borrowed as immutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:31:22 | LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {} | -----^^^------------- | | | | - | | | also moved here - | | mutable borrow occurs here - | immutable borrow occurs here + | | | also moved into `c` here + | | mutable borrow, by `b`, occurs here + | immutable borrow, by `a`, occurs here -error: cannot move out of `b` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-ref-mut-and-ref.rs:31:30 | LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {} | ---------^^^- | | | - | | move out of `b` occurs here - | borrow of `b` occurs here + | | value moved into `c` here + | value borrowed, by `b`, here error[E0502]: cannot borrow `_` as immutable because it is also borrowed as mutable --> $DIR/borrowck-pat-ref-mut-and-ref.rs:11:31 diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.rs b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.rs index 77cd779d716..f5c39a7ac52 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.rs +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.rs @@ -9,12 +9,12 @@ fn main() { fn u() -> U { U } fn f1(ref mut a @ ref mut b: U) {} - //~^ ERROR cannot borrow `a` as mutable more than once at a time + //~^ ERROR cannot borrow value as mutable more than once at a time fn f2(ref mut a @ ref mut b: U) {} - //~^ ERROR cannot borrow `a` as mutable more than once at a time + //~^ ERROR cannot borrow value as mutable more than once at a time fn f3( ref mut a @ [ - //~^ ERROR cannot borrow `a` as mutable more than once at a time + //~^ ERROR cannot borrow value as mutable more than once at a time [ref b @ .., _], [_, ref mut mid @ ..], .., @@ -22,29 +22,29 @@ fn main() { ] : [[U; 4]; 5] ) {} fn f4_also_moved(ref mut a @ ref mut b @ c: U) {} - //~^ ERROR cannot borrow `a` as mutable more than once at a time - //~| ERROR cannot move out of `b` because it is borrowed + //~^ ERROR cannot borrow value as mutable more than once at a time + //~| ERROR cannot move out of value because it is borrowed let ref mut a @ ref mut b = U; - //~^ ERROR cannot borrow `a` as mutable more than once at a time + //~^ ERROR cannot borrow value as mutable more than once at a time //~| ERROR cannot borrow `_` as mutable more than once at a time drop(a); let ref mut a @ ref mut b = U; - //~^ ERROR cannot borrow `a` as mutable more than once at a time + //~^ ERROR cannot borrow value as mutable more than once at a time drop(b); let ref mut a @ ref mut b = U; - //~^ ERROR cannot borrow `a` as mutable more than once at a time + //~^ ERROR cannot borrow value as mutable more than once at a time let ref mut a @ ref mut b = U; - //~^ ERROR cannot borrow `a` as mutable more than once at a time + //~^ ERROR cannot borrow value as mutable more than once at a time //~| ERROR cannot borrow `_` as mutable more than once at a time *a = U; let ref mut a @ ref mut b = U; - //~^ ERROR cannot borrow `a` as mutable more than once at a time + //~^ ERROR cannot borrow value as mutable more than once at a time *b = U; let ref mut a @ ( - //~^ ERROR cannot borrow `a` as mutable more than once at a time + //~^ ERROR cannot borrow value as mutable more than once at a time ref mut b, [ ref mut c, @@ -54,7 +54,7 @@ fn main() { ) = (U, [U, U, U]); let ref mut a @ ( - //~^ ERROR cannot borrow `a` as mutable more than once at a time + //~^ ERROR cannot borrow value as mutable more than once at a time ref mut b, [ ref mut c, @@ -80,21 +80,21 @@ fn main() { match Ok(U) { ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - //~^ ERROR cannot borrow `a` as mutable more than once at a time - //~| ERROR cannot borrow `a` as mutable more than once at a time + //~^ ERROR cannot borrow value as mutable more than once at a time + //~| ERROR cannot borrow value as mutable more than once at a time } } match Ok(U) { ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - //~^ ERROR cannot borrow `a` as mutable more than once at a time - //~| ERROR cannot borrow `a` as mutable more than once at a time + //~^ ERROR cannot borrow value as mutable more than once at a time + //~| ERROR cannot borrow value as mutable more than once at a time *b = U; } } match Ok(U) { ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - //~^ ERROR cannot borrow `a` as mutable more than once at a time - //~| ERROR cannot borrow `a` as mutable more than once at a time + //~^ ERROR cannot borrow value as mutable more than once at a time + //~| ERROR cannot borrow value as mutable more than once at a time //~| ERROR cannot borrow `_` as mutable more than once at a time //~| ERROR cannot borrow `_` as mutable more than once at a time *a = Err(U); @@ -105,8 +105,8 @@ fn main() { } match Ok(U) { ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { - //~^ ERROR cannot borrow `a` as mutable more than once at a time - //~| ERROR cannot borrow `a` as mutable more than once at a time + //~^ ERROR cannot borrow value as mutable more than once at a time + //~| ERROR cannot borrow value as mutable more than once at a time //~| ERROR cannot borrow `_` as mutable more than once at a time //~| ERROR cannot borrow `_` as mutable more than once at a time drop(a); diff --git a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr index a6d66787364..4e96c6e1669 100644 --- a/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr +++ b/src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr @@ -1,93 +1,93 @@ -error: cannot borrow `a` as mutable more than once at a time +error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:28:9 | LL | let ref mut a @ ref mut b = U; | ---------^^^--------- | | | - | | another mutable borrow occurs here - | first mutable borrow occurs here + | | another mutable borrow, by `b`, occurs here + | first mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable more than once at a time +error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:32:9 | LL | let ref mut a @ ref mut b = U; | ---------^^^--------- | | | - | | another mutable borrow occurs here - | first mutable borrow occurs here + | | another mutable borrow, by `b`, occurs here + | first mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable more than once at a time +error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:35:9 | LL | let ref mut a @ ref mut b = U; | ---------^^^--------- | | | - | | another mutable borrow occurs here - | first mutable borrow occurs here + | | another mutable borrow, by `b`, occurs here + | first mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable more than once at a time +error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:38:9 | LL | let ref mut a @ ref mut b = U; | ---------^^^--------- | | | - | | another mutable borrow occurs here - | first mutable borrow occurs here + | | another mutable borrow, by `b`, occurs here + | first mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable more than once at a time +error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:42:9 | LL | let ref mut a @ ref mut b = U; | ---------^^^--------- | | | - | | another mutable borrow occurs here - | first mutable borrow occurs here + | | another mutable borrow, by `b`, occurs here + | first mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable more than once at a time +error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:46:9 | LL | let ref mut a @ ( | ^-------- | | - | _________first mutable borrow occurs here + | _________first mutable borrow, by `a`, occurs here | | LL | | LL | | ref mut b, - | | --------- another mutable borrow occurs here + | | --------- another mutable borrow, by `b`, occurs here LL | | [ LL | | ref mut c, - | | --------- another mutable borrow occurs here + | | --------- another mutable borrow, by `c`, occurs here LL | | ref mut d, - | | --------- another mutable borrow occurs here + | | --------- another mutable borrow, by `d`, occurs here LL | | ref e, - | | ----- also borrowed as immutable here + | | ----- also borrowed as immutable, by `e`, here LL | | ] LL | | ) = (U, [U, U, U]); | |_____^ -error: cannot borrow `a` as mutable more than once at a time +error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:56:9 | LL | let ref mut a @ ( | ^-------- | | - | _________first mutable borrow occurs here + | _________first mutable borrow, by `a`, occurs here | | LL | | LL | | ref mut b, - | | --------- another mutable borrow occurs here + | | --------- another mutable borrow, by `b`, occurs here LL | | [ LL | | ref mut c, - | | --------- another mutable borrow occurs here + | | --------- another mutable borrow, by `c`, occurs here LL | | ref mut d, - | | --------- another mutable borrow occurs here + | | --------- another mutable borrow, by `d`, occurs here LL | | ref e, - | | ----- also borrowed as immutable here + | | ----- also borrowed as immutable, by `e`, here LL | | ] LL | | ) = (u(), [u(), u(), u()]); | |_________^ -error: borrow of moved value: `a` +error: borrow of moved value --> $DIR/borrowck-pat-ref-mut-twice.rs:66:9 | LL | let a @ (ref mut b, ref mut c) = (U, U); @@ -95,10 +95,10 @@ LL | let a @ (ref mut b, ref mut c) = (U, U); | | | | | | | value borrowed here after move | | value borrowed here after move - | value moved here + | value moved into `a` here | move occurs because `a` has type `(main::U, main::U)` which does implement the `Copy` trait -error: borrow of moved value: `a` +error: borrow of moved value --> $DIR/borrowck-pat-ref-mut-twice.rs:70:9 | LL | let a @ (b, [c, d]) = &mut val; // Same as ^-- @@ -107,20 +107,20 @@ LL | let a @ (b, [c, d]) = &mut val; // Same as ^-- | | | | value borrowed here after move | | | value borrowed here after move | | value borrowed here after move - | value moved here + | value moved into `a` here | move occurs because `a` has type `&mut (main::U, [main::U; 2])` which does implement the `Copy` trait -error: borrow of moved value: `a` +error: borrow of moved value --> $DIR/borrowck-pat-ref-mut-twice.rs:74:9 | LL | let a @ &mut ref mut b = &mut U; | -^^^^^^^^--------- | | | | | value borrowed here after move - | value moved here + | value moved into `a` here | move occurs because `a` has type `&mut main::U` which does implement the `Copy` trait -error: borrow of moved value: `a` +error: borrow of moved value --> $DIR/borrowck-pat-ref-mut-twice.rs:77:9 | LL | let a @ &mut (ref mut b, ref mut c) = &mut (U, U); @@ -128,135 +128,135 @@ LL | let a @ &mut (ref mut b, ref mut c) = &mut (U, U); | | | | | | | value borrowed here after move | | value borrowed here after move - | value moved here + | value moved into `a` here | move occurs because `a` has type `&mut (main::U, main::U)` which does implement the `Copy` trait -error: cannot borrow `a` as mutable more than once at a time +error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:82:9 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^---------^ | | | - | | another mutable borrow occurs here - | first mutable borrow occurs here + | | another mutable borrow, by `b`, occurs here + | first mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable more than once at a time +error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:82:37 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^^---------^ | | | - | | another mutable borrow occurs here - | first mutable borrow occurs here + | | another mutable borrow, by `b`, occurs here + | first mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable more than once at a time +error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:88:9 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^---------^ | | | - | | another mutable borrow occurs here - | first mutable borrow occurs here + | | another mutable borrow, by `b`, occurs here + | first mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable more than once at a time +error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:88:37 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^^---------^ | | | - | | another mutable borrow occurs here - | first mutable borrow occurs here + | | another mutable borrow, by `b`, occurs here + | first mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable more than once at a time +error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:95:9 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^---------^ | | | - | | another mutable borrow occurs here - | first mutable borrow occurs here + | | another mutable borrow, by `b`, occurs here + | first mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable more than once at a time +error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:95:37 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^^---------^ | | | - | | another mutable borrow occurs here - | first mutable borrow occurs here + | | another mutable borrow, by `b`, occurs here + | first mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable more than once at a time +error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:107:9 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^---------^ | | | - | | another mutable borrow occurs here - | first mutable borrow occurs here + | | another mutable borrow, by `b`, occurs here + | first mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable more than once at a time +error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:107:37 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------^^^^^^^---------^ | | | - | | another mutable borrow occurs here - | first mutable borrow occurs here + | | another mutable borrow, by `b`, occurs here + | first mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable more than once at a time +error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:11:11 | LL | fn f1(ref mut a @ ref mut b: U) {} | ---------^^^--------- | | | - | | another mutable borrow occurs here - | first mutable borrow occurs here + | | another mutable borrow, by `b`, occurs here + | first mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable more than once at a time +error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:13:11 | LL | fn f2(ref mut a @ ref mut b: U) {} | ---------^^^--------- | | | - | | another mutable borrow occurs here - | first mutable borrow occurs here + | | another mutable borrow, by `b`, occurs here + | first mutable borrow, by `a`, occurs here -error: cannot borrow `a` as mutable more than once at a time +error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:16:9 | LL | ref mut a @ [ | ^-------- | | - | _________first mutable borrow occurs here + | _________first mutable borrow, by `a`, occurs here | | LL | | LL | | [ref b @ .., _], - | | ---------- also borrowed as immutable here + | | ---------- also borrowed as immutable, by `b`, here LL | | [_, ref mut mid @ ..], - | | ---------------- another mutable borrow occurs here + | | ---------------- another mutable borrow, by `mid`, occurs here LL | | .., LL | | [..], LL | | ] : [[U; 4]; 5] | |_________^ -error: cannot borrow `a` as mutable more than once at a time +error: cannot borrow value as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:24:22 | LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {} | ---------^^^------------- | | | | - | | | also moved here - | | another mutable borrow occurs here - | first mutable borrow occurs here + | | | also moved into `c` here + | | another mutable borrow, by `b`, occurs here + | first mutable borrow, by `a`, occurs here -error: cannot move out of `b` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/borrowck-pat-ref-mut-twice.rs:24:34 | LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {} | ---------^^^- | | | - | | move out of `b` occurs here - | borrow of `b` occurs here + | | value moved into `c` here + | value borrowed, by `b`, here error[E0499]: cannot borrow `_` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:28:21 diff --git a/src/test/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.rs b/src/test/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.rs index 94becb9e8b8..b40c3e3358a 100644 --- a/src/test/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.rs +++ b/src/test/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.rs @@ -25,24 +25,24 @@ fn main() { let ref a @ b = &NotCopy; // OK let _: &&NotCopy = a; - let ref a @ b = NotCopy; //~ ERROR cannot move out of `a` because it is borrowed + let ref a @ b = NotCopy; //~ ERROR cannot move out of value because it is borrowed let _a: &NotCopy = a; let _b: NotCopy = b; - let ref mut a @ b = NotCopy; //~ ERROR cannot move out of `a` because it is borrowed + let ref mut a @ b = NotCopy; //~ ERROR cannot move out of value because it is borrowed //~^ ERROR cannot move out of `_` because it is borrowed let _a: &NotCopy = a; let _b: NotCopy = b; match Ok(NotCopy) { Ok(ref a @ b) | Err(b @ ref a) => { - //~^ ERROR cannot move out of `a` because it is borrowed - //~| ERROR borrow of moved value: `b` + //~^ ERROR cannot move out of value because it is borrowed + //~| ERROR borrow of moved value let _a: &NotCopy = a; let _b: NotCopy = b; } } match NotCopy { ref a @ b => { - //~^ ERROR cannot move out of `a` because it is borrowed + //~^ ERROR cannot move out of value because it is borrowed let _a: &NotCopy = a; let _b: NotCopy = b; } diff --git a/src/test/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr b/src/test/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr index dfc6e16600e..697a8b96e63 100644 --- a/src/test/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr +++ b/src/test/ui/pattern/bindings-after-at/default-binding-modes-both-sides-independent.stderr @@ -1,48 +1,48 @@ -error: cannot move out of `a` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/default-binding-modes-both-sides-independent.rs:28:9 | LL | let ref a @ b = NotCopy; | -----^^^- | | | - | | move out of `a` occurs here - | borrow of `a` occurs here + | | value moved into `b` here + | value borrowed, by `a`, here -error: cannot move out of `a` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/default-binding-modes-both-sides-independent.rs:31:9 | LL | let ref mut a @ b = NotCopy; | ---------^^^- | | | - | | move out of `a` occurs here - | borrow of `a` occurs here + | | value moved into `b` here + | value borrowed, by `a`, here -error: cannot move out of `a` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/default-binding-modes-both-sides-independent.rs:36:12 | LL | Ok(ref a @ b) | Err(b @ ref a) => { | -----^^^- | | | - | | move out of `a` occurs here - | borrow of `a` occurs here + | | value moved into `b` here + | value borrowed, by `a`, here -error: borrow of moved value: `b` +error: borrow of moved value --> $DIR/default-binding-modes-both-sides-independent.rs:36:29 | LL | Ok(ref a @ b) | Err(b @ ref a) => { | -^^^----- | | | | | value borrowed here after move - | value moved here + | value moved into `b` here | move occurs because `b` has type `main::NotCopy` which does implement the `Copy` trait -error: cannot move out of `a` because it is borrowed +error: cannot move out of value because it is borrowed --> $DIR/default-binding-modes-both-sides-independent.rs:44:9 | LL | ref a @ b => { | -----^^^- | | | - | | move out of `a` occurs here - | borrow of `a` occurs here + | | value moved into `b` here + | value borrowed, by `a`, here error[E0505]: cannot move out of `_` because it is borrowed --> $DIR/default-binding-modes-both-sides-independent.rs:31:21 |
