mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Shrink binding span.
This commit is contained in:
parent
fea7b59d12
commit
28d74a9b72
@ -879,17 +879,25 @@ fn check_borrow_conflicts_in_at_patterns(cx: &MatchVisitor<'_, '_, '_>, pat: &Pa
|
||||
hir::PatKind::Binding(.., name, Some(sub)) => (*name, sub),
|
||||
_ => return,
|
||||
};
|
||||
let binding_span = pat.span.with_hi(name.span.hi());
|
||||
let mk_span = |pat_span, ident_span: Span| {
|
||||
if let Some(ident_span) = ident_span.find_ancestor_inside(pat_span) {
|
||||
pat_span.with_hi(ident_span.hi())
|
||||
} else {
|
||||
pat_span
|
||||
}
|
||||
};
|
||||
let binding_span = mk_span(pat.span, name.span);
|
||||
|
||||
let typeck_results = cx.typeck_results;
|
||||
let sess = cx.tcx.sess;
|
||||
|
||||
// Get the binding move, extract the mutability if by-ref.
|
||||
let mut_outer = match typeck_results.extract_binding_mode(sess, pat.hir_id, pat.span) {
|
||||
let mut_outer = match typeck_results.extract_binding_mode(sess, pat.hir_id, binding_span) {
|
||||
Some(ty::BindByValue(_)) if is_binding_by_move(cx, pat.hir_id) => {
|
||||
// We have `x @ pat` where `x` is by-move. Reject all borrows in `pat`.
|
||||
let mut conflicts_ref = Vec::new();
|
||||
sub.each_binding(|_, hir_id, span, _| {
|
||||
sub.each_binding(|_, hir_id, span, ident| {
|
||||
let span = mk_span(span, ident.span);
|
||||
match typeck_results.extract_binding_mode(sess, hir_id, span) {
|
||||
Some(ty::BindByValue(_)) | None => {}
|
||||
Some(ty::BindByReference(_)) => conflicts_ref.push(span),
|
||||
@ -897,7 +905,7 @@ fn check_borrow_conflicts_in_at_patterns(cx: &MatchVisitor<'_, '_, '_>, pat: &Pa
|
||||
});
|
||||
if !conflicts_ref.is_empty() {
|
||||
sess.emit_err(BorrowOfMovedValue {
|
||||
span: pat.span,
|
||||
span: binding_span,
|
||||
binding_span,
|
||||
conflicts_ref,
|
||||
name,
|
||||
@ -920,6 +928,7 @@ fn check_borrow_conflicts_in_at_patterns(cx: &MatchVisitor<'_, '_, '_>, pat: &Pa
|
||||
let mut conflicts_mut_mut = Vec::new();
|
||||
let mut conflicts_mut_ref = Vec::new();
|
||||
sub.each_binding(|_, hir_id, span, name| {
|
||||
let span = mk_span(span, name.span);
|
||||
match typeck_results.extract_binding_mode(sess, hir_id, span) {
|
||||
Some(ty::BindByReference(mut_inner)) => match (mut_outer, mut_inner) {
|
||||
// Both sides are `ref`.
|
||||
@ -957,20 +966,20 @@ fn check_borrow_conflicts_in_at_patterns(cx: &MatchVisitor<'_, '_, '_>, pat: &Pa
|
||||
// Report errors if any.
|
||||
if report_mut_mut {
|
||||
// Report mutability conflicts for e.g. `ref mut x @ Some(ref mut y)`.
|
||||
sess.emit_err(MultipleMutBorrows { span: pat.span, occurences });
|
||||
sess.emit_err(MultipleMutBorrows { span: binding_span, occurences });
|
||||
} else if report_mut_ref {
|
||||
// Report mutability conflicts for e.g. `ref x @ Some(ref mut y)` or the converse.
|
||||
match mut_outer {
|
||||
Mutability::Mut => {
|
||||
sess.emit_err(AlreadyMutBorrowed { span: pat.span, occurences });
|
||||
sess.emit_err(AlreadyMutBorrowed { span: binding_span, occurences });
|
||||
}
|
||||
Mutability::Not => {
|
||||
sess.emit_err(AlreadyBorrowed { span: pat.span, occurences });
|
||||
sess.emit_err(AlreadyBorrowed { span: binding_span, occurences });
|
||||
}
|
||||
};
|
||||
} else if report_move_conflict {
|
||||
// Report by-ref and by-move conflicts, e.g. `ref x @ y`.
|
||||
sess.emit_err(MovedWhileBorrowed { span: pat.span, occurences });
|
||||
sess.emit_err(MovedWhileBorrowed { span: binding_span, occurences });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,18 +2,16 @@ error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:36:9
|
||||
|
|
||||
LL | ref foo @ [.., ref mut bar] => (),
|
||||
| -------^^^^^^^^-----------^
|
||||
| | |
|
||||
| | value is mutably borrowed by `bar` here
|
||||
| ^^^^^^^ ----------- value is mutably borrowed by `bar` here
|
||||
| |
|
||||
| value is borrowed by `foo` here
|
||||
|
||||
error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:120:9
|
||||
|
|
||||
LL | ref foo @ Some(box ref mut s) => (),
|
||||
| -------^^^^^^^^^^^^---------^
|
||||
| | |
|
||||
| | value is mutably borrowed by `s` here
|
||||
| ^^^^^^^ --------- value is mutably borrowed by `s` here
|
||||
| |
|
||||
| value is borrowed by `foo` here
|
||||
|
||||
error[E0382]: borrow of moved value: `x`
|
||||
|
@ -2,18 +2,16 @@ error: cannot move out of value because it is borrowed
|
||||
--> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:12:14
|
||||
|
|
||||
LL | Some(ref _y @ _z) => {}
|
||||
| ------^^^--
|
||||
| | |
|
||||
| | value is moved into `_z` here
|
||||
| ^^^^^^ -- value is moved into `_z` here
|
||||
| |
|
||||
| value is borrowed by `_y` here
|
||||
|
||||
error: borrow of moved value
|
||||
--> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:19:14
|
||||
|
|
||||
LL | Some(_z @ ref _y) => {}
|
||||
| --^^^------
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| ^^ ------ value borrowed here after move
|
||||
| |
|
||||
| value moved into `_z` here
|
||||
| move occurs because `_z` has type `X` which does not implement the `Copy` trait
|
||||
|
|
||||
@ -26,18 +24,16 @@ error: cannot move out of value because it is borrowed
|
||||
--> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:26:14
|
||||
|
|
||||
LL | Some(ref mut _y @ _z) => {}
|
||||
| ----------^^^--
|
||||
| | |
|
||||
| | value is moved into `_z` here
|
||||
| ^^^^^^^^^^ -- value is moved into `_z` here
|
||||
| |
|
||||
| value is mutably borrowed by `_y` here
|
||||
|
||||
error: borrow of moved value
|
||||
--> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:33:14
|
||||
|
|
||||
LL | Some(_z @ ref mut _y) => {}
|
||||
| --^^^----------
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| ^^ ---------- value borrowed here after move
|
||||
| |
|
||||
| value moved into `_z` here
|
||||
| move occurs because `_z` has type `X` which does not implement the `Copy` trait
|
||||
|
|
||||
|
@ -2,72 +2,64 @@ error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:31:9
|
||||
|
|
||||
LL | let ref a @ box b = Box::new(NC);
|
||||
| -----^^^^^^^-
|
||||
| | |
|
||||
| | value is moved into `b` here
|
||||
| ^^^^^ - value is moved into `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:34:9
|
||||
|
|
||||
LL | let ref a @ box ref mut b = Box::new(nc());
|
||||
| -----^^^^^^^---------
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:36:9
|
||||
|
|
||||
LL | let ref a @ box ref mut b = Box::new(NC);
|
||||
| -----^^^^^^^---------
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:38:9
|
||||
|
|
||||
LL | let ref a @ box ref mut b = Box::new(NC);
|
||||
| -----^^^^^^^---------
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:42:9
|
||||
|
|
||||
LL | let ref a @ box ref mut b = Box::new(NC);
|
||||
| -----^^^^^^^---------
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:48:9
|
||||
|
|
||||
LL | let ref mut a @ box ref b = Box::new(NC);
|
||||
| ---------^^^^^^^-----
|
||||
| | |
|
||||
| | value is borrowed by `b` here
|
||||
| ^^^^^^^^^ ----- value is borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:62:9
|
||||
|
|
||||
LL | ref mut a @ box ref b => {
|
||||
| ---------^^^^^^^-----
|
||||
| | |
|
||||
| | value is borrowed by `b` here
|
||||
| ^^^^^^^^^ ----- value is borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-at-and-box.rs:54:11
|
||||
|
|
||||
LL | fn f5(ref mut a @ box ref b: Box<NC>) {
|
||||
| ---------^^^^^^^-----
|
||||
| | |
|
||||
| | value is borrowed by `b` here
|
||||
| ^^^^^^^^^ ----- value is borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error[E0382]: borrow of moved value
|
||||
|
@ -2,9 +2,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse-promotion.rs:6:9
|
||||
|
|
||||
LL | let a @ ref b = U;
|
||||
| -^^^-----
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| ^ ----- value borrowed here after move
|
||||
| |
|
||||
| value moved into `a` here
|
||||
| move occurs because `a` has type `U` which does not implement the `Copy` trait
|
||||
|
|
||||
|
@ -2,9 +2,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:22:9
|
||||
|
|
||||
LL | let a @ ref b = U;
|
||||
| -^^^-----
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| ^ ----- value borrowed here after move
|
||||
| |
|
||||
| value moved into `a` here
|
||||
| move occurs because `a` has type `U` which does not implement the `Copy` trait
|
||||
|
|
||||
@ -17,9 +16,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:9
|
||||
|
|
||||
LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U);
|
||||
| -^^^^^^^^^^^^---------^^^^^^-----^
|
||||
| | | |
|
||||
| | | value borrowed here after move
|
||||
| ^ --------- ----- value borrowed here after move
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| value moved into `a` here
|
||||
| move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait
|
||||
@ -33,9 +31,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:14
|
||||
|
|
||||
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 into `b` here
|
||||
| move occurs because `b` has type `U` which does not implement the `Copy` trait
|
||||
|
|
||||
@ -48,9 +45,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:33
|
||||
|
|
||||
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 into `d` here
|
||||
| move occurs because `d` has type `U` which does not implement the `Copy` trait
|
||||
|
|
||||
@ -63,9 +59,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:29:9
|
||||
|
|
||||
LL | let a @ [ref mut b, ref c] = [U, U];
|
||||
| -^^^^---------^^-----^
|
||||
| | | |
|
||||
| | | value borrowed here after move
|
||||
| ^ --------- ----- value borrowed here after move
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| value moved into `a` here
|
||||
| move occurs because `a` has type `[U; 2]` which does not implement the `Copy` trait
|
||||
@ -79,9 +74,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:31:9
|
||||
|
|
||||
LL | let a @ ref b = u();
|
||||
| -^^^-----
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| ^ ----- value borrowed here after move
|
||||
| |
|
||||
| value moved into `a` here
|
||||
| move occurs because `a` has type `U` which does not implement the `Copy` trait
|
||||
|
|
||||
@ -94,9 +88,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:33:9
|
||||
|
|
||||
LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u());
|
||||
| -^^^^^^^^^^^^---------^^^^^^-----^
|
||||
| | | |
|
||||
| | | value borrowed here after move
|
||||
| ^ --------- ----- value borrowed here after move
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| value moved into `a` here
|
||||
| move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait
|
||||
@ -110,9 +103,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:33:14
|
||||
|
|
||||
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 into `b` here
|
||||
| move occurs because `b` has type `U` which does not implement the `Copy` trait
|
||||
|
|
||||
@ -125,9 +117,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:33:33
|
||||
|
|
||||
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 into `d` here
|
||||
| move occurs because `d` has type `U` which does not implement the `Copy` trait
|
||||
|
|
||||
@ -140,9 +131,8 @@ 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()];
|
||||
| -^^^^---------^^-----^
|
||||
| | | |
|
||||
| | | value borrowed here after move
|
||||
| ^ --------- ----- value borrowed here after move
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| value moved into `a` here
|
||||
| move occurs because `a` has type `[U; 2]` which does not implement the `Copy` trait
|
||||
@ -156,9 +146,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:42:9
|
||||
|
|
||||
LL | a @ Some(ref b) => {}
|
||||
| -^^^^^^^^-----^
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| ^ ----- value borrowed here after move
|
||||
| |
|
||||
| value moved into `a` here
|
||||
| move occurs because `a` has type `Option<U>` which does not implement the `Copy` trait
|
||||
|
|
||||
@ -171,9 +160,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:47:9
|
||||
|
|
||||
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
|
||||
| -^^^^^^^^^^^^^^^^^---------^^^^^^-----^^
|
||||
| | | |
|
||||
| | | value borrowed here after move
|
||||
| ^ --------- ----- value borrowed here after move
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| value moved into `a` here
|
||||
| move occurs because `a` has type `Option<(U, U)>` which does not implement the `Copy` trait
|
||||
@ -187,9 +175,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:47:19
|
||||
|
|
||||
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
|
||||
| -----^^^---------
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| ^^^^^ --------- value borrowed here after move
|
||||
| |
|
||||
| value moved into `b` here
|
||||
| move occurs because `b` has type `U` which does not implement the `Copy` trait
|
||||
|
|
||||
@ -202,9 +189,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:47:38
|
||||
|
|
||||
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
|
||||
| -^^^-----
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| ^ ----- value borrowed here after move
|
||||
| |
|
||||
| value moved into `d` here
|
||||
| move occurs because `d` has type `U` which does not implement the `Copy` trait
|
||||
|
|
||||
@ -217,9 +203,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:55:9
|
||||
|
|
||||
LL | mut a @ Some([ref b, ref mut c]) => {}
|
||||
| -----^^^^^^^^^-----^^---------^^
|
||||
| | | |
|
||||
| | | value borrowed here after move
|
||||
| ^^^^^ ----- --------- value borrowed here after move
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| value moved into `a` here
|
||||
| move occurs because `a` has type `Option<[U; 2]>` which does not implement the `Copy` trait
|
||||
@ -233,9 +218,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:61:9
|
||||
|
|
||||
LL | a @ Some(ref b) => {}
|
||||
| -^^^^^^^^-----^
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| ^ ----- value borrowed here after move
|
||||
| |
|
||||
| value moved into `a` here
|
||||
| move occurs because `a` has type `Option<U>` which does not implement the `Copy` trait
|
||||
|
|
||||
@ -248,9 +232,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:67:9
|
||||
|
|
||||
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
|
||||
| -^^^^^^^^^^^^^^^^^---------^^^^^^-----^^
|
||||
| | | |
|
||||
| | | value borrowed here after move
|
||||
| ^ --------- ----- value borrowed here after move
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| value moved into `a` here
|
||||
| move occurs because `a` has type `Option<(U, U)>` which does not implement the `Copy` trait
|
||||
@ -264,9 +247,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:67:19
|
||||
|
|
||||
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
|
||||
| -----^^^---------
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| ^^^^^ --------- value borrowed here after move
|
||||
| |
|
||||
| value moved into `b` here
|
||||
| move occurs because `b` has type `U` which does not implement the `Copy` trait
|
||||
|
|
||||
@ -279,9 +261,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:67:38
|
||||
|
|
||||
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
|
||||
| -^^^-----
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| ^ ----- value borrowed here after move
|
||||
| |
|
||||
| value moved into `d` here
|
||||
| move occurs because `d` has type `U` which does not implement the `Copy` trait
|
||||
|
|
||||
@ -294,9 +275,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:75:9
|
||||
|
|
||||
LL | mut a @ Some([ref b, ref mut c]) => {}
|
||||
| -----^^^^^^^^^-----^^---------^^
|
||||
| | | |
|
||||
| | | value borrowed here after move
|
||||
| ^^^^^ ----- --------- value borrowed here after move
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| value moved into `a` here
|
||||
| move occurs because `a` has type `Option<[U; 2]>` which does not implement the `Copy` trait
|
||||
@ -310,9 +290,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:11:11
|
||||
|
|
||||
LL | fn f1(a @ ref b: U) {}
|
||||
| -^^^-----
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| ^ ----- value borrowed here after move
|
||||
| |
|
||||
| value moved into `a` here
|
||||
| move occurs because `a` has type `U` which does not implement the `Copy` trait
|
||||
|
|
||||
@ -325,9 +304,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:14:11
|
||||
|
|
||||
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 borrowed here after move
|
||||
| value moved into `a` here
|
||||
| move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait
|
||||
@ -341,9 +319,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:14:20
|
||||
|
|
||||
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 into `b` here
|
||||
| move occurs because `b` has type `U` which does not implement the `Copy` trait
|
||||
|
|
||||
@ -356,9 +333,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:14:31
|
||||
|
|
||||
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 into `d` here
|
||||
| move occurs because `d` has type `U` which does not implement the `Copy` trait
|
||||
|
|
||||
@ -371,9 +347,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:19:11
|
||||
|
|
||||
LL | fn f3(a @ [ref mut b, ref c]: [U; 2]) {}
|
||||
| -^^^^---------^^-----^
|
||||
| | | |
|
||||
| | | value borrowed here after move
|
||||
| ^ --------- ----- value borrowed here after move
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| value moved into `a` here
|
||||
| move occurs because `a` has type `[U; 2]` which does not implement the `Copy` trait
|
||||
|
@ -2,18 +2,16 @@ error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:24:9
|
||||
|
|
||||
LL | let ref a @ b = U;
|
||||
| -----^^^-
|
||||
| | |
|
||||
| | value is moved into `b` here
|
||||
| ^^^^^ - value is moved into `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:26:9
|
||||
|
|
||||
LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U);
|
||||
| -----^^^^^^^^^^^^-----^^^^^^^^^^-^
|
||||
| | | |
|
||||
| | | value is moved into `e` here
|
||||
| ^^^^^ ----- - value is moved into `e` here
|
||||
| | |
|
||||
| | value is moved into `c` here
|
||||
| value is borrowed by `a` here
|
||||
|
||||
@ -21,27 +19,24 @@ error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:26:18
|
||||
|
|
||||
LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U);
|
||||
| -----^^^-----
|
||||
| | |
|
||||
| | value is moved into `c` here
|
||||
| ^^^^^ ----- value is moved into `c` here
|
||||
| |
|
||||
| value is borrowed by `b` here
|
||||
|
||||
error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:26:33
|
||||
|
|
||||
LL | let ref a @ (ref b @ mut c, ref d @ e) = (U, U);
|
||||
| -----^^^-
|
||||
| | |
|
||||
| | value is moved into `e` here
|
||||
| ^^^^^ - value is moved into `e` here
|
||||
| |
|
||||
| value is borrowed by `d` here
|
||||
|
||||
error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:30:9
|
||||
|
|
||||
LL | let ref mut a @ [b, mut c] = [U, U];
|
||||
| ---------^^^^-^^-----^
|
||||
| | | |
|
||||
| | | value is moved into `c` here
|
||||
| ^^^^^^^^^ - ----- value is moved into `c` here
|
||||
| | |
|
||||
| | value is moved into `b` here
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
@ -49,18 +44,16 @@ error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:33:9
|
||||
|
|
||||
LL | let ref a @ b = u();
|
||||
| -----^^^-
|
||||
| | |
|
||||
| | value is moved into `b` here
|
||||
| ^^^^^ - value is moved into `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:36:9
|
||||
|
|
||||
LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u());
|
||||
| -----^^^^^^^^^^^^-----^^^^^^^^^^-^
|
||||
| | | |
|
||||
| | | value is moved into `e` here
|
||||
| ^^^^^ ----- - value is moved into `e` here
|
||||
| | |
|
||||
| | value is moved into `c` here
|
||||
| value is borrowed by `a` here
|
||||
|
||||
@ -68,27 +61,24 @@ error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:36:18
|
||||
|
|
||||
LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u());
|
||||
| -----^^^-----
|
||||
| | |
|
||||
| | value is moved into `c` here
|
||||
| ^^^^^ ----- value is moved into `c` here
|
||||
| |
|
||||
| value is borrowed by `b` here
|
||||
|
||||
error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:36:33
|
||||
|
|
||||
LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u());
|
||||
| -----^^^-
|
||||
| | |
|
||||
| | value is moved into `e` here
|
||||
| ^^^^^ - value is moved into `e` here
|
||||
| |
|
||||
| value is borrowed by `d` here
|
||||
|
||||
error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:42:9
|
||||
|
|
||||
LL | let ref mut a @ [b, mut c] = [u(), u()];
|
||||
| ---------^^^^-^^-----^
|
||||
| | | |
|
||||
| | | value is moved into `c` here
|
||||
| ^^^^^^^^^ - ----- value is moved into `c` here
|
||||
| | |
|
||||
| | value is moved into `b` here
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
@ -96,18 +86,16 @@ error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:47:9
|
||||
|
|
||||
LL | ref a @ Some(b) => {}
|
||||
| -----^^^^^^^^-^
|
||||
| | |
|
||||
| | value is moved into `b` here
|
||||
| ^^^^^ - value is moved into `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:52:9
|
||||
|
|
||||
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
|
||||
| -----^^^^^^^^^^^^^^^^^-----^^^^^^^^^^-^^
|
||||
| | | |
|
||||
| | | value is moved into `e` here
|
||||
| ^^^^^ ----- - value is moved into `e` here
|
||||
| | |
|
||||
| | value is moved into `c` here
|
||||
| value is borrowed by `a` here
|
||||
|
||||
@ -115,27 +103,24 @@ error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:52:23
|
||||
|
|
||||
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
|
||||
| -----^^^-----
|
||||
| | |
|
||||
| | value is moved into `c` here
|
||||
| ^^^^^ ----- value is moved into `c` here
|
||||
| |
|
||||
| value is borrowed by `b` here
|
||||
|
||||
error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:52:38
|
||||
|
|
||||
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
|
||||
| -----^^^-
|
||||
| | |
|
||||
| | value is moved into `e` here
|
||||
| ^^^^^ - value is moved into `e` here
|
||||
| |
|
||||
| value is borrowed by `d` here
|
||||
|
||||
error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:59:9
|
||||
|
|
||||
LL | ref mut a @ Some([b, mut c]) => {}
|
||||
| ---------^^^^^^^^^-^^-----^^
|
||||
| | | |
|
||||
| | | value is moved into `c` here
|
||||
| ^^^^^^^^^ - ----- value is moved into `c` here
|
||||
| | |
|
||||
| | value is moved into `b` here
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
@ -143,18 +128,16 @@ error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:64:9
|
||||
|
|
||||
LL | ref a @ Some(b) => {}
|
||||
| -----^^^^^^^^-^
|
||||
| | |
|
||||
| | value is moved into `b` here
|
||||
| ^^^^^ - value is moved into `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:69:9
|
||||
|
|
||||
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
|
||||
| -----^^^^^^^^^^^^^^^^^-----^^^^^^^^^^-^^
|
||||
| | | |
|
||||
| | | value is moved into `e` here
|
||||
| ^^^^^ ----- - value is moved into `e` here
|
||||
| | |
|
||||
| | value is moved into `c` here
|
||||
| value is borrowed by `a` here
|
||||
|
||||
@ -162,27 +145,24 @@ error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:69:23
|
||||
|
|
||||
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
|
||||
| -----^^^-----
|
||||
| | |
|
||||
| | value is moved into `c` here
|
||||
| ^^^^^ ----- value is moved into `c` here
|
||||
| |
|
||||
| value is borrowed by `b` here
|
||||
|
||||
error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:69:38
|
||||
|
|
||||
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
|
||||
| -----^^^-
|
||||
| | |
|
||||
| | value is moved into `e` here
|
||||
| ^^^^^ - value is moved into `e` here
|
||||
| |
|
||||
| value is borrowed by `d` here
|
||||
|
||||
error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:78:9
|
||||
|
|
||||
LL | ref mut a @ Some([b, mut c]) => {}
|
||||
| ---------^^^^^^^^^-^^-----^^
|
||||
| | | |
|
||||
| | | value is moved into `c` here
|
||||
| ^^^^^^^^^ - ----- value is moved into `c` here
|
||||
| | |
|
||||
| | value is moved into `b` here
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
@ -190,18 +170,16 @@ error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:11:11
|
||||
|
|
||||
LL | fn f1(ref a @ b: U) {}
|
||||
| -----^^^-
|
||||
| | |
|
||||
| | value is moved into `b` here
|
||||
| ^^^^^ - value is moved into `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:14:11
|
||||
|
|
||||
LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {}
|
||||
| -----^^^^^^^^^^^^-----^^^^^^^^^^-^
|
||||
| | | |
|
||||
| | | value is moved into `e` here
|
||||
| ^^^^^ ----- - value is moved into `e` here
|
||||
| | |
|
||||
| | value is moved into `c` here
|
||||
| value is borrowed by `a` here
|
||||
|
||||
@ -209,27 +187,24 @@ error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:14:20
|
||||
|
|
||||
LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {}
|
||||
| -----^^^-----
|
||||
| | |
|
||||
| | value is moved into `c` here
|
||||
| ^^^^^ ----- value is moved into `c` here
|
||||
| |
|
||||
| value is borrowed by `b` here
|
||||
|
||||
error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-by-move-and-ref.rs:14:35
|
||||
|
|
||||
LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {}
|
||||
| -----^^^-
|
||||
| | |
|
||||
| | value is moved into `e` here
|
||||
| ^^^^^ - value is moved into `e` here
|
||||
| |
|
||||
| value is borrowed by `d` here
|
||||
|
||||
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]) {}
|
||||
| ---------^^^^-^^-----^
|
||||
| | | |
|
||||
| | | value is moved into `c` here
|
||||
| ^^^^^^^^^ - ----- value is moved into `c` here
|
||||
| | |
|
||||
| | value is moved into `b` here
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
|
@ -2,18 +2,16 @@ error: cannot borrow value as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:8:9
|
||||
|
|
||||
LL | ref mut z @ &mut Some(ref a) => {
|
||||
| ---------^^^^^^^^^^^^^-----^
|
||||
| | |
|
||||
| | value is borrowed by `a` here
|
||||
| ^^^^^^^^^ ----- value is borrowed by `a` here
|
||||
| |
|
||||
| value is mutably borrowed by `z` here
|
||||
|
||||
error: cannot borrow value as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:33:9
|
||||
|
|
||||
LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub
|
||||
| ---------^^^^-----------------^
|
||||
| | | |
|
||||
| | | value is mutably borrowed by `c` here
|
||||
| ^^^^^^^^^ ----- --------- value is mutably borrowed by `c` here
|
||||
| | |
|
||||
| | value is borrowed by `b` here
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
@ -21,36 +19,32 @@ error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:33:22
|
||||
|
|
||||
LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub
|
||||
| -----^^^---------
|
||||
| | |
|
||||
| | value is mutably borrowed by `c` here
|
||||
| ^^^^^ --------- value is mutably borrowed by `c` here
|
||||
| |
|
||||
| value is borrowed by `b` here
|
||||
|
||||
error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:37:9
|
||||
|
|
||||
LL | let ref a @ ref mut b = U;
|
||||
| -----^^^---------
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:39:9
|
||||
|
|
||||
LL | let ref mut a @ ref b = U;
|
||||
| ---------^^^-----
|
||||
| | |
|
||||
| | value is borrowed by `b` here
|
||||
| ^^^^^^^^^ ----- value is borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:41:9
|
||||
|
|
||||
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
|
||||
| -----^^^^---------^^---------^
|
||||
| | | |
|
||||
| | | value is mutably borrowed by `c` here
|
||||
| ^^^^^ --------- --------- value is mutably borrowed by `c` here
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| value is borrowed by `a` here
|
||||
|
||||
@ -58,9 +52,8 @@ error: cannot borrow value as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:43:9
|
||||
|
|
||||
LL | let ref mut a @ (ref b, ref c) = (U, U);
|
||||
| ---------^^^^-----^^-----^
|
||||
| | | |
|
||||
| | | value is borrowed by `c` here
|
||||
| ^^^^^^^^^ ----- ----- value is borrowed by `c` here
|
||||
| | |
|
||||
| | value is borrowed by `b` here
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
@ -68,153 +61,136 @@ error: cannot borrow value as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:46:9
|
||||
|
|
||||
LL | let ref mut a @ ref b = u();
|
||||
| ---------^^^-----
|
||||
| | |
|
||||
| | value is borrowed by `b` here
|
||||
| ^^^^^^^^^ ----- value is borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:51:9
|
||||
|
|
||||
LL | let ref a @ ref mut b = u();
|
||||
| -----^^^---------
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:57:9
|
||||
|
|
||||
LL | let ref mut a @ ref b = U;
|
||||
| ---------^^^-----
|
||||
| | |
|
||||
| | value is borrowed by `b` here
|
||||
| ^^^^^^^^^ ----- value is borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:61:9
|
||||
|
|
||||
LL | let ref a @ ref mut b = U;
|
||||
| -----^^^---------
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:67:9
|
||||
|
|
||||
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => {
|
||||
| ---------^^^^^^-----^
|
||||
| | |
|
||||
| | value is borrowed by `b` here
|
||||
| ^^^^^^^^^ ----- value is borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:67:33
|
||||
|
|
||||
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => {
|
||||
| ---------^^^^^^^-----^
|
||||
| | |
|
||||
| | value is borrowed by `b` here
|
||||
| ^^^^^^^^^ ----- value is borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:9
|
||||
|
|
||||
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
|
||||
| -----^^^^^^---------^
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:33
|
||||
|
|
||||
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
|
||||
| -----^^^^^^^---------^
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:87:9
|
||||
|
|
||||
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {}
|
||||
| -----^^^^^^---------^
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:87:33
|
||||
|
|
||||
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {}
|
||||
| -----^^^^^^^---------^
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:94:9
|
||||
|
|
||||
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {}
|
||||
| ---------^^^^^^-----^
|
||||
| | |
|
||||
| | value is borrowed by `b` here
|
||||
| ^^^^^^^^^ ----- value is borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:94:33
|
||||
|
|
||||
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {}
|
||||
| ---------^^^^^^^-----^
|
||||
| | |
|
||||
| | value is borrowed by `b` here
|
||||
| ^^^^^^^^^ ----- value is borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:101:9
|
||||
|
|
||||
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {}
|
||||
| -----^^^^^^---------^
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:101:33
|
||||
|
|
||||
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {}
|
||||
| -----^^^^^^^---------^
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:109:9
|
||||
|
|
||||
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {}
|
||||
| ---------^^^^^^-----^
|
||||
| | |
|
||||
| | value is borrowed by `b` here
|
||||
| ^^^^^^^^^ ----- value is borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:109:33
|
||||
|
|
||||
LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {}
|
||||
| ---------^^^^^^^-----^
|
||||
| | |
|
||||
| | value is borrowed by `b` here
|
||||
| ^^^^^^^^^ ----- value is borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:117:9
|
||||
|
|
||||
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
|
||||
| -----^^^^---------^^---------^
|
||||
| | | |
|
||||
| | | value is mutably borrowed by `c` here
|
||||
| ^^^^^ --------- --------- value is mutably borrowed by `c` here
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| value is borrowed by `a` here
|
||||
|
||||
@ -222,9 +198,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:123:9
|
||||
|
|
||||
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
|
||||
| -----^^^^---------^^---------^
|
||||
| | | |
|
||||
| | | value is mutably borrowed by `c` here
|
||||
| ^^^^^ --------- --------- value is mutably borrowed by `c` here
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| value is borrowed by `a` here
|
||||
|
||||
@ -232,9 +207,8 @@ error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:129:9
|
||||
|
|
||||
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
|
||||
| -----^^^^---------^^---------^
|
||||
| | | |
|
||||
| | | value is mutably borrowed by `c` here
|
||||
| ^^^^^ --------- --------- value is mutably borrowed by `c` here
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| value is borrowed by `a` here
|
||||
|
||||
@ -242,9 +216,8 @@ error: cannot borrow value as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:134:9
|
||||
|
|
||||
LL | let ref mut a @ (ref b, ref c) = (U, U);
|
||||
| ---------^^^^-----^^-----^
|
||||
| | | |
|
||||
| | | value is borrowed by `c` here
|
||||
| ^^^^^^^^^ ----- ----- value is borrowed by `c` here
|
||||
| | |
|
||||
| | value is borrowed by `b` here
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
@ -252,36 +225,32 @@ error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:22:11
|
||||
|
|
||||
LL | fn f1(ref a @ ref mut b: U) {}
|
||||
| -----^^^---------
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as immutable because it is also borrowed as mutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:24:11
|
||||
|
|
||||
LL | fn f2(ref mut a @ ref b: U) {}
|
||||
| ---------^^^-----
|
||||
| | |
|
||||
| | value is borrowed by `b` here
|
||||
| ^^^^^^^^^ ----- value is borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:26:11
|
||||
|
|
||||
LL | fn f3(ref a @ [ref b, ref mut mid @ .., ref c]: [U; 4]) {}
|
||||
| -----^^^^^^^^^^^----------------^^^^^^^^
|
||||
| | |
|
||||
| | value is mutably borrowed by `mid` here
|
||||
| ^^^^^ ----------- value is mutably borrowed by `mid` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable because it is also borrowed as immutable
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:22
|
||||
|
|
||||
LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {}
|
||||
| -----^^^-------------
|
||||
| | | |
|
||||
| | | value is moved into `c` here
|
||||
| ^^^^^ --------- - value is moved into `c` here
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| value is borrowed by `a` here
|
||||
|
||||
@ -289,9 +258,8 @@ error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:30
|
||||
|
|
||||
LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {}
|
||||
| ---------^^^-
|
||||
| | |
|
||||
| | value is moved into `c` here
|
||||
| ^^^^^^^^^ - value is moved into `c` here
|
||||
| |
|
||||
| value is mutably borrowed by `b` here
|
||||
|
||||
error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
|
||||
|
@ -2,98 +2,80 @@ error: cannot borrow value as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:26:9
|
||||
|
|
||||
LL | let ref mut a @ ref mut b = U;
|
||||
| ---------^^^---------
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:29:9
|
||||
|
|
||||
LL | let ref mut a @ ref mut b = U;
|
||||
| ---------^^^---------
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:33:9
|
||||
|
|
||||
LL | let ref mut a @ ref mut b = U;
|
||||
| ---------^^^---------
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:36:9
|
||||
|
|
||||
LL | let ref mut a @ ref mut b = U;
|
||||
| ---------^^^---------
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:39:9
|
||||
|
|
||||
LL | let ref mut a @ ref mut b = U;
|
||||
| ---------^^^---------
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:44:9
|
||||
|
|
||||
LL | let ref mut a @ (
|
||||
| ^--------
|
||||
| |
|
||||
| _________value is mutably borrowed by `a` here
|
||||
| |
|
||||
LL | |
|
||||
LL | | ref mut b,
|
||||
| | --------- value is mutably borrowed by `b` here
|
||||
LL | | [
|
||||
LL | | ref mut c,
|
||||
| | --------- value is mutably borrowed by `c` here
|
||||
LL | | ref mut d,
|
||||
| | --------- value is mutably borrowed by `d` here
|
||||
LL | | ref e,
|
||||
| | ----- value is borrowed by `e` here
|
||||
LL | | ]
|
||||
LL | | ) = (U, [U, U, U]);
|
||||
| |_____^
|
||||
LL | let ref mut a @ (
|
||||
| ^^^^^^^^^ value is mutably borrowed by `a` here
|
||||
LL |
|
||||
LL | ref mut b,
|
||||
| --------- value is mutably borrowed by `b` here
|
||||
LL | [
|
||||
LL | ref mut c,
|
||||
| --------- value is mutably borrowed by `c` here
|
||||
LL | ref mut d,
|
||||
| --------- value is mutably borrowed by `d` here
|
||||
LL | ref e,
|
||||
| ----- value is borrowed by `e` here
|
||||
|
||||
error: cannot borrow value as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:54:9
|
||||
|
|
||||
LL | let ref mut a @ (
|
||||
| ^--------
|
||||
| |
|
||||
| _________value is mutably borrowed by `a` here
|
||||
| |
|
||||
LL | |
|
||||
LL | | ref mut b,
|
||||
| | --------- value is mutably borrowed by `b` here
|
||||
LL | | [
|
||||
LL | | ref mut c,
|
||||
| | --------- value is mutably borrowed by `c` here
|
||||
LL | | ref mut d,
|
||||
| | --------- value is mutably borrowed by `d` here
|
||||
LL | | ref e,
|
||||
| | ----- value is borrowed by `e` here
|
||||
LL | | ]
|
||||
LL | | ) = (u(), [u(), u(), u()]);
|
||||
| |_________^
|
||||
LL | let ref mut a @ (
|
||||
| ^^^^^^^^^ value is mutably borrowed by `a` here
|
||||
LL |
|
||||
LL | ref mut b,
|
||||
| --------- value is mutably borrowed by `b` here
|
||||
LL | [
|
||||
LL | ref mut c,
|
||||
| --------- value is mutably borrowed by `c` here
|
||||
LL | ref mut d,
|
||||
| --------- value is mutably borrowed by `d` here
|
||||
LL | ref e,
|
||||
| ----- value is borrowed by `e` here
|
||||
|
||||
error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:64:9
|
||||
|
|
||||
LL | let a @ (ref mut b, ref mut c) = (U, U);
|
||||
| -^^^^---------^^---------^
|
||||
| | | |
|
||||
| | | value borrowed here after move
|
||||
| ^ --------- --------- value borrowed here after move
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| value moved into `a` here
|
||||
| move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait
|
||||
@ -107,9 +89,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:67:9
|
||||
|
|
||||
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 borrowed here after move
|
||||
| value moved into `a` here
|
||||
@ -124,9 +105,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:70:9
|
||||
|
|
||||
LL | let a @ &mut ref mut b = &mut U;
|
||||
| -^^^^^^^^---------
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| ^ --------- value borrowed here after move
|
||||
| |
|
||||
| value moved into `a` here
|
||||
| move occurs because `a` has type `&mut U` which does not implement the `Copy` trait
|
||||
|
|
||||
@ -139,9 +119,8 @@ error: borrow of moved value
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:72:9
|
||||
|
|
||||
LL | let a @ &mut (ref mut b, ref mut c) = &mut (U, U);
|
||||
| -^^^^^^^^^---------^^---------^
|
||||
| | | |
|
||||
| | | value borrowed here after move
|
||||
| ^ --------- --------- value borrowed here after move
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| value moved into `a` here
|
||||
| move occurs because `a` has type `&mut (U, U)` which does not implement the `Copy` trait
|
||||
@ -155,117 +134,99 @@ error: cannot borrow value as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:76:9
|
||||
|
|
||||
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
||||
| ---------^^^^^^---------^
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:76:37
|
||||
|
|
||||
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
||||
| ---------^^^^^^^---------^
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
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) => {
|
||||
| ---------^^^^^^---------^
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
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) => {
|
||||
| ---------^^^^^^^---------^
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:89:9
|
||||
|
|
||||
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
||||
| ---------^^^^^^---------^
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:89:37
|
||||
|
|
||||
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
||||
| ---------^^^^^^^---------^
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:101:9
|
||||
|
|
||||
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
||||
| ---------^^^^^^---------^
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:101:37
|
||||
|
|
||||
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
||||
| ---------^^^^^^^---------^
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:8:11
|
||||
|
|
||||
LL | fn f1(ref mut a @ ref mut b: U) {}
|
||||
| ---------^^^---------
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:10:11
|
||||
|
|
||||
LL | fn f2(ref mut a @ ref mut b: U) {}
|
||||
| ---------^^^---------
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot borrow value as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:13:9
|
||||
|
|
||||
LL | ref mut a @ [
|
||||
| ^--------
|
||||
| |
|
||||
| _________value is mutably borrowed by `a` here
|
||||
| |
|
||||
LL | |
|
||||
LL | | [ref b @ .., _],
|
||||
| | ---------- value is borrowed by `b` here
|
||||
LL | | [_, ref mut mid @ ..],
|
||||
| | ---------------- value is mutably borrowed by `mid` here
|
||||
LL | | ..,
|
||||
LL | | [..],
|
||||
LL | | ] : [[U; 4]; 5]
|
||||
| |_________^
|
||||
LL | ref mut a @ [
|
||||
| ^^^^^^^^^ value is mutably borrowed by `a` here
|
||||
LL |
|
||||
LL | [ref b @ .., _],
|
||||
| ----- value is borrowed by `b` here
|
||||
LL | [_, ref mut mid @ ..],
|
||||
| ----------- value is mutably borrowed by `mid` here
|
||||
|
||||
error: cannot borrow value as mutable more than once at a time
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:21:22
|
||||
|
|
||||
LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {}
|
||||
| ---------^^^-------------
|
||||
| | | |
|
||||
| | | value is moved into `c` here
|
||||
| ^^^^^^^^^ --------- - value is moved into `c` here
|
||||
| | |
|
||||
| | value is mutably borrowed by `b` here
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
@ -273,9 +234,8 @@ error: cannot move out of value because it is borrowed
|
||||
--> $DIR/borrowck-pat-ref-mut-twice.rs:21:34
|
||||
|
|
||||
LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {}
|
||||
| ---------^^^-
|
||||
| | |
|
||||
| | value is moved into `c` here
|
||||
| ^^^^^^^^^ - value is moved into `c` here
|
||||
| |
|
||||
| value is mutably borrowed by `b` here
|
||||
|
||||
error[E0499]: cannot borrow value as mutable more than once at a time
|
||||
|
@ -2,36 +2,32 @@ error: cannot move out of value because it is borrowed
|
||||
--> $DIR/default-binding-modes-both-sides-independent.rs:26:9
|
||||
|
|
||||
LL | let ref a @ b = NotCopy;
|
||||
| -----^^^-
|
||||
| | |
|
||||
| | value is moved into `b` here
|
||||
| ^^^^^ - value is moved into `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: cannot move out of value because it is borrowed
|
||||
--> $DIR/default-binding-modes-both-sides-independent.rs:29:9
|
||||
|
|
||||
LL | let ref mut a @ b = NotCopy;
|
||||
| ---------^^^-
|
||||
| | |
|
||||
| | value is moved into `b` here
|
||||
| ^^^^^^^^^ - value is moved into `b` here
|
||||
| |
|
||||
| value is mutably borrowed by `a` here
|
||||
|
||||
error: cannot move out of value because it is borrowed
|
||||
--> $DIR/default-binding-modes-both-sides-independent.rs:34:12
|
||||
|
|
||||
LL | Ok(ref a @ b) | Err(b @ ref a) => {
|
||||
| -----^^^-
|
||||
| | |
|
||||
| | value is moved into `b` here
|
||||
| ^^^^^ - value is moved into `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error: borrow of moved value
|
||||
--> $DIR/default-binding-modes-both-sides-independent.rs:34:29
|
||||
|
|
||||
LL | Ok(ref a @ b) | Err(b @ ref a) => {
|
||||
| -^^^-----
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| ^ ----- value borrowed here after move
|
||||
| |
|
||||
| value moved into `b` here
|
||||
| move occurs because `b` has type `NotCopy` which does not implement the `Copy` trait
|
||||
|
|
||||
@ -44,9 +40,8 @@ error: cannot move out of value because it is borrowed
|
||||
--> $DIR/default-binding-modes-both-sides-independent.rs:42:9
|
||||
|
|
||||
LL | ref a @ b => {
|
||||
| -----^^^-
|
||||
| | |
|
||||
| | value is moved into `b` here
|
||||
| ^^^^^ - value is moved into `b` here
|
||||
| |
|
||||
| value is borrowed by `a` here
|
||||
|
||||
error[E0382]: borrow of moved value
|
||||
|
@ -2,9 +2,8 @@ error: borrow of moved value
|
||||
--> $DIR/ref-pattern-binding.rs:10:9
|
||||
|
|
||||
LL | let _moved @ ref _from = String::from("foo");
|
||||
| ------^^^---------
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| ^^^^^^ --------- value borrowed here after move
|
||||
| |
|
||||
| value moved into `_moved` here
|
||||
| move occurs because `_moved` has type `String` which does not implement the `Copy` trait
|
||||
|
|
||||
@ -17,27 +16,24 @@ error: cannot move out of value because it is borrowed
|
||||
--> $DIR/ref-pattern-binding.rs:11:9
|
||||
|
|
||||
LL | let ref _moved @ _from = String::from("foo");
|
||||
| ----------^^^-----
|
||||
| | |
|
||||
| | value is moved into `_from` here
|
||||
| ^^^^^^^^^^ ----- value is moved into `_from` here
|
||||
| |
|
||||
| value is borrowed by `_moved` here
|
||||
|
||||
error: cannot move out of value because it is borrowed
|
||||
--> $DIR/ref-pattern-binding.rs:15:9
|
||||
|
|
||||
LL | let ref _moved @ S { f } = S { f: String::from("foo") };
|
||||
| ----------^^^^^^^-^^
|
||||
| | |
|
||||
| | value is moved into `f` here
|
||||
| ^^^^^^^^^^ - value is moved into `f` here
|
||||
| |
|
||||
| value is borrowed by `_moved` here
|
||||
|
||||
error: borrow of moved value
|
||||
--> $DIR/ref-pattern-binding.rs:18:9
|
||||
|
|
||||
LL | let _moved @ S { ref f } = S { f: String::from("foo") };
|
||||
| ------^^^^^^^-----^^
|
||||
| | |
|
||||
| | value borrowed here after move
|
||||
| ^^^^^^ ----- value borrowed here after move
|
||||
| |
|
||||
| value moved into `_moved` here
|
||||
| move occurs because `_moved` has type `S` which does not implement the `Copy` trait
|
||||
|
|
||||
|
Loading…
Reference in New Issue
Block a user