error: cannot borrow `a` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:24:9 | LL | let ref mut a @ ref mut b = U; | ---------^^^--------- | | | | | another mutable borrow occurs here | first mutable borrow occurs here error: cannot borrow `a` 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 error: cannot borrow `a` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:31:9 | LL | let ref mut a @ ref mut b = U; | ---------^^^--------- | | | | | another mutable borrow occurs here | first mutable borrow occurs here error: cannot borrow `a` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:34:9 | LL | let ref mut a @ ref mut b = U; | ---------^^^--------- | | | | | another mutable borrow occurs here | first mutable borrow occurs here error: cannot borrow `a` 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 error: cannot borrow `a` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:42:9 | LL | let ref mut a @ ( | ^-------- | | | _________first mutable borrow occurs here | | LL | | LL | | ref mut b, | | --------- another mutable borrow occurs here LL | | [ LL | | ref mut c, | | --------- another mutable borrow occurs here LL | | ref mut d, | | --------- another mutable borrow occurs here LL | | ref e, | | ----- also borrowed as immutable here LL | | ] LL | | ) = (U, [U, U, U]); | |_____^ error: cannot borrow `a` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:52:9 | LL | let ref mut a @ ( | ^-------- | | | _________first mutable borrow occurs here | | LL | | LL | | ref mut b, | | --------- another mutable borrow occurs here LL | | [ LL | | ref mut c, | | --------- another mutable borrow occurs here LL | | ref mut d, | | --------- another mutable borrow occurs here LL | | ref e, | | ----- also borrowed as immutable here LL | | ] LL | | ) = (u(), [u(), u(), u()]); | |_________^ error[E0007]: cannot bind by-move with sub-bindings --> $DIR/borrowck-pat-ref-mut-twice.rs:62:9 | LL | let a @ (ref mut b, ref mut c) = (U, U); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it error[E0007]: cannot bind by-move with sub-bindings --> $DIR/borrowck-pat-ref-mut-twice.rs:66:9 | LL | let a @ (b, [c, d]) = &mut val; // Same as ^-- | ^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it error[E0007]: cannot bind by-move with sub-bindings --> $DIR/borrowck-pat-ref-mut-twice.rs:70:9 | LL | let a @ &mut ref mut b = &mut U; | ^^^^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it error[E0007]: cannot bind by-move with sub-bindings --> $DIR/borrowck-pat-ref-mut-twice.rs:73:9 | LL | let a @ &mut (ref mut b, ref mut c) = &mut (U, U); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it error: cannot borrow `a` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:78: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 error: cannot borrow `a` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:78: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 error: cannot borrow `a` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:84: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 error: cannot borrow `a` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:84: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 error: cannot borrow `a` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:91: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 error: cannot borrow `a` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:91: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 error: cannot borrow `a` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:103: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 error: cannot borrow `a` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:103: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 error: cannot borrow `a` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:10:11 | LL | fn f1(ref mut a @ ref mut b: U) {} | ---------^^^--------- | | | | | another mutable borrow occurs here | first mutable borrow occurs here error: cannot borrow `a` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:12:11 | LL | fn f2(ref mut a @ ref mut b: U) {} | ---------^^^--------- | | | | | another mutable borrow occurs here | first mutable borrow occurs here error: cannot borrow `a` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:15:9 | LL | ref mut a @ [ | ^-------- | | | _________first mutable borrow occurs here | | LL | | LL | | [ref b @ .., _], | | ---------- also borrowed as immutable here LL | | [_, ref mut mid @ ..], | | ---------------- another mutable borrow occurs here LL | | .., LL | | [..], LL | | ] : [[U; 4]; 5] | |_________^ error[E0499]: cannot borrow `_` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:24:21 | LL | let ref mut a @ ref mut b = U; | ------------^^^^^^^^^ | | | | | second mutable borrow occurs here | first mutable borrow occurs here ... LL | drop(a); | - first borrow later used here error[E0499]: cannot borrow `_` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:34:21 | LL | let ref mut a @ ref mut b = U; | ------------^^^^^^^^^ | | | | | second mutable borrow occurs here | first mutable borrow occurs here ... LL | *a = U; | ------ first borrow later used here error[E0382]: borrow of moved value --> $DIR/borrowck-pat-ref-mut-twice.rs:62:25 | LL | let a @ (ref mut b, ref mut c) = (U, U); | ----------------^^^^^^^^^- ------ move occurs because value has type `(main::U, main::U)`, which does not implement the `Copy` trait | | | | | value borrowed here after move | value moved here error[E0382]: borrow of moved value --> $DIR/borrowck-pat-ref-mut-twice.rs:66:21 | LL | let a @ (b, [c, d]) = &mut val; // Same as ^-- | ------------^-- -------- move occurs because value has type `&mut (main::U, [main::U; 2])`, which does not implement the `Copy` trait | | | | | value borrowed here after move | value moved here error[E0382]: borrow of moved value --> $DIR/borrowck-pat-ref-mut-twice.rs:70:18 | LL | let a @ &mut ref mut b = &mut U; | ---------^^^^^^^^^ ------ move occurs because value has type `&mut main::U`, which does not implement the `Copy` trait | | | | | value borrowed here after move | value moved here error[E0382]: borrow of moved value --> $DIR/borrowck-pat-ref-mut-twice.rs:73:30 | LL | let a @ &mut (ref mut b, ref mut c) = &mut (U, U); | ---------------------^^^^^^^^^- ----------- move occurs because value has type `&mut (main::U, main::U)`, which does not implement the `Copy` trait | | | | | value borrowed here after move | value moved here error[E0499]: cannot borrow `_` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:91:24 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------------^^^^^^^^^- | | | | | second mutable borrow occurs here | first mutable borrow occurs here ... LL | *a = Err(U); | ----------- first borrow later used here error[E0499]: cannot borrow `_` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:91:53 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ----------------^^^^^^^^^- | | | | | second mutable borrow occurs here | first mutable borrow occurs here ... LL | *a = Err(U); | ----------- first borrow later used here error[E0499]: cannot borrow `_` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:103:24 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ---------------^^^^^^^^^- | | | | | second mutable borrow occurs here | first mutable borrow occurs here ... LL | drop(a); | - first borrow later used here error[E0499]: cannot borrow `_` as mutable more than once at a time --> $DIR/borrowck-pat-ref-mut-twice.rs:103:53 | LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { | ----------------^^^^^^^^^- | | | | | second mutable borrow occurs here | first mutable borrow occurs here ... LL | drop(a); | - first borrow later used here error: aborting due to 32 previous errors Some errors have detailed explanations: E0007, E0382, E0499. For more information about an error, try `rustc --explain E0007`.