1
Fork 0

Rollup merge of #101399 - cjgillot:borrowck-binding-span, r=estebank

Shrink span for bindings with subpatterns.

Bindings with nested patterns (`binding @ pat` syntax) currently point to the full pattern.  This PR proposes to shrink the span to stop before the ````@`.```  This makes the diagnostics for move/mutability conflicts clearer, as they not point to the `binding` only, instead of the full pat.

r? ```@estebank```
This commit is contained in:
Dylan DPC 2022-09-08 11:55:06 +05:30 committed by GitHub
commit 0d61a507f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 190 additions and 236 deletions

View file

@ -1036,7 +1036,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
VarBindingForm { VarBindingForm {
binding_mode, binding_mode,
opt_ty_info, opt_ty_info,
opt_match_place: Some((Some(place), span)), opt_match_place: Some((None, span)),
pat_span: span, pat_span: span,
}, },
))))) )))))

View file

@ -202,6 +202,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
fn lower_pattern_unadjusted(&mut self, pat: &'tcx hir::Pat<'tcx>) -> Box<Pat<'tcx>> { fn lower_pattern_unadjusted(&mut self, pat: &'tcx hir::Pat<'tcx>) -> Box<Pat<'tcx>> {
let mut ty = self.typeck_results.node_type(pat.hir_id); let mut ty = self.typeck_results.node_type(pat.hir_id);
let mut span = pat.span;
let kind = match pat.kind { let kind = match pat.kind {
hir::PatKind::Wild => PatKind::Wild, hir::PatKind::Wild => PatKind::Wild,
@ -262,6 +263,10 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
} }
hir::PatKind::Binding(_, id, ident, ref sub) => { hir::PatKind::Binding(_, id, ident, ref sub) => {
if let Some(ident_span) = ident.span.find_ancestor_inside(span) {
span = span.with_hi(ident_span.hi());
}
let bm = *self let bm = *self
.typeck_results .typeck_results
.pat_binding_modes() .pat_binding_modes()
@ -326,7 +331,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
hir::PatKind::Or(ref pats) => PatKind::Or { pats: self.lower_patterns(pats) }, hir::PatKind::Or(ref pats) => PatKind::Or { pats: self.lower_patterns(pats) },
}; };
Box::new(Pat { span: pat.span, ty, kind }) Box::new(Pat { span, ty, kind })
} }
fn lower_tuple_subpats( fn lower_tuple_subpats(

View file

@ -8,13 +8,13 @@ fn match_tuple(_1: (u32, bool, Option<i32>, u32)) -> u32 {
let mut _4: bool; // in scope 0 at $DIR/exponential-or.rs:+2:70: +2:77 let mut _4: bool; // in scope 0 at $DIR/exponential-or.rs:+2:70: +2:77
let mut _5: bool; // in scope 0 at $DIR/exponential-or.rs:+2:62: +2:67 let mut _5: bool; // in scope 0 at $DIR/exponential-or.rs:+2:62: +2:67
let mut _6: bool; // in scope 0 at $DIR/exponential-or.rs:+2:62: +2:67 let mut _6: bool; // in scope 0 at $DIR/exponential-or.rs:+2:62: +2:67
let _7: u32; // in scope 0 at $DIR/exponential-or.rs:+2:10: +2:21 let _7: u32; // in scope 0 at $DIR/exponential-or.rs:+2:10: +2:11
let _8: u32; // in scope 0 at $DIR/exponential-or.rs:+2:57: +2:78 let _8: u32; // in scope 0 at $DIR/exponential-or.rs:+2:57: +2:58
let mut _9: u32; // in scope 0 at $DIR/exponential-or.rs:+2:83: +2:84 let mut _9: u32; // in scope 0 at $DIR/exponential-or.rs:+2:83: +2:84
let mut _10: u32; // in scope 0 at $DIR/exponential-or.rs:+2:87: +2:88 let mut _10: u32; // in scope 0 at $DIR/exponential-or.rs:+2:87: +2:88
scope 1 { scope 1 {
debug y => _7; // in scope 1 at $DIR/exponential-or.rs:+2:10: +2:21 debug y => _7; // in scope 1 at $DIR/exponential-or.rs:+2:10: +2:11
debug z => _8; // in scope 1 at $DIR/exponential-or.rs:+2:57: +2:78 debug z => _8; // in scope 1 at $DIR/exponential-or.rs:+2:57: +2:58
} }
bb0: { bb0: {
@ -61,10 +61,10 @@ fn match_tuple(_1: (u32, bool, Option<i32>, u32)) -> u32 {
} }
bb9: { bb9: {
StorageLive(_7); // scope 0 at $DIR/exponential-or.rs:+2:10: +2:21 StorageLive(_7); // scope 0 at $DIR/exponential-or.rs:+2:10: +2:11
_7 = (_1.0: u32); // scope 0 at $DIR/exponential-or.rs:+2:10: +2:21 _7 = (_1.0: u32); // scope 0 at $DIR/exponential-or.rs:+2:10: +2:11
StorageLive(_8); // scope 0 at $DIR/exponential-or.rs:+2:57: +2:78 StorageLive(_8); // scope 0 at $DIR/exponential-or.rs:+2:57: +2:58
_8 = (_1.3: u32); // scope 0 at $DIR/exponential-or.rs:+2:57: +2:78 _8 = (_1.3: u32); // scope 0 at $DIR/exponential-or.rs:+2:57: +2:58
StorageLive(_9); // scope 1 at $DIR/exponential-or.rs:+2:83: +2:84 StorageLive(_9); // scope 1 at $DIR/exponential-or.rs:+2:83: +2:84
_9 = _7; // scope 1 at $DIR/exponential-or.rs:+2:83: +2:84 _9 = _7; // scope 1 at $DIR/exponential-or.rs:+2:83: +2:84
StorageLive(_10); // scope 1 at $DIR/exponential-or.rs:+2:87: +2:88 StorageLive(_10); // scope 1 at $DIR/exponential-or.rs:+2:87: +2:88

View file

@ -15,9 +15,9 @@ fn move_out_by_subslice() -> () {
let mut _11: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26 let mut _11: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
scope 1 { scope 1 {
debug a => _1; // in scope 1 at $DIR/uniform_array_move_out.rs:+1:9: +1:10 debug a => _1; // in scope 1 at $DIR/uniform_array_move_out.rs:+1:9: +1:10
let _12: [std::boxed::Box<i32>; 2]; // in scope 1 at $DIR/uniform_array_move_out.rs:+2:10: +2:17 let _12: [std::boxed::Box<i32>; 2]; // in scope 1 at $DIR/uniform_array_move_out.rs:+2:10: +2:12
scope 4 { scope 4 {
debug _y => _12; // in scope 4 at $DIR/uniform_array_move_out.rs:+2:10: +2:17 debug _y => _12; // in scope 4 at $DIR/uniform_array_move_out.rs:+2:10: +2:12
} }
} }
scope 2 { scope 2 {
@ -77,8 +77,8 @@ fn move_out_by_subslice() -> () {
bb6: { bb6: {
StorageDead(_2); // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27 StorageDead(_2); // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27
FakeRead(ForLet(None), _1); // scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10 FakeRead(ForLet(None), _1); // scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10
StorageLive(_12); // scope 1 at $DIR/uniform_array_move_out.rs:+2:10: +2:17 StorageLive(_12); // scope 1 at $DIR/uniform_array_move_out.rs:+2:10: +2:12
_12 = move _1[0..2]; // scope 1 at $DIR/uniform_array_move_out.rs:+2:10: +2:17 _12 = move _1[0..2]; // scope 1 at $DIR/uniform_array_move_out.rs:+2:10: +2:12
_0 = const (); // scope 0 at $DIR/uniform_array_move_out.rs:+0:27: +3:2 _0 = const (); // scope 0 at $DIR/uniform_array_move_out.rs:+0:27: +3:2
drop(_12) -> [return: bb7, unwind: bb9]; // scope 1 at $DIR/uniform_array_move_out.rs:+3:1: +3:2 drop(_12) -> [return: bb7, unwind: bb9]; // scope 1 at $DIR/uniform_array_move_out.rs:+3:1: +3:2
} }

View file

@ -23,7 +23,7 @@ LL | fn bindings_after_at_slice_patterns_move_binding(x: [String; 4]) {
| - move occurs because `x` has type `[String; 4]`, which does not implement the `Copy` trait | - move occurs because `x` has type `[String; 4]`, which does not implement the `Copy` trait
LL | match x { LL | match x {
LL | a @ [.., _] => (), LL | a @ [.., _] => (),
| ----------- value moved here | - value moved here
... ...
LL | &x; LL | &x;
| ^^ value borrowed here after move | ^^ value borrowed here after move
@ -32,7 +32,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:28:5 --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:28:5
| |
LL | ref mut foo @ [.., _] => Some(foo), LL | ref mut foo @ [.., _] => Some(foo),
| --------------------- mutable borrow occurs here | ----------- mutable borrow occurs here
... ...
LL | &x; LL | &x;
| ^^ immutable borrow occurs here | ^^ immutable borrow occurs here
@ -44,7 +44,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:50:5 --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:50:5
| |
LL | [ref foo @ .., ref bar] => Some(foo), LL | [ref foo @ .., ref bar] => Some(foo),
| ------------ immutable borrow occurs here | ------- immutable borrow occurs here
... ...
LL | &mut x; LL | &mut x;
| ^^^^^^ mutable borrow occurs here | ^^^^^^ mutable borrow occurs here
@ -56,7 +56,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:62:5 --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:62:5
| |
LL | ref foo @ [.., ref bar] => Some(foo), LL | ref foo @ [.., ref bar] => Some(foo),
| ----------------------- immutable borrow occurs here | ------- immutable borrow occurs here
... ...
LL | &mut x; LL | &mut x;
| ^^^^^^ mutable borrow occurs here | ^^^^^^ mutable borrow occurs here
@ -71,7 +71,7 @@ LL | fn bindings_after_at_or_patterns_move(x: Option<Test>) {
| - move occurs because `x` has type `Option<Test>`, which does not implement the `Copy` trait | - move occurs because `x` has type `Option<Test>`, which does not implement the `Copy` trait
LL | match x { LL | match x {
LL | foo @ Some(Test::Foo | Test::Bar) => (), LL | foo @ Some(Test::Foo | Test::Bar) => (),
| --------------------------------- | ---
| | | |
| value moved here | value moved here
| value moved here | value moved here
@ -83,7 +83,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:86:5 --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:86:5
| |
LL | ref foo @ Some(Test::Foo | Test::Bar) => Some(foo), LL | ref foo @ Some(Test::Foo | Test::Bar) => Some(foo),
| ------------------------------------- immutable borrow occurs here | ------- immutable borrow occurs here
... ...
LL | &mut x; LL | &mut x;
| ^^^^^^ mutable borrow occurs here | ^^^^^^ mutable borrow occurs here
@ -95,7 +95,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:98:5 --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:98:5
| |
LL | ref mut foo @ Some(Test::Foo | Test::Bar) => Some(foo), LL | ref mut foo @ Some(Test::Foo | Test::Bar) => Some(foo),
| ----------------------------------------- mutable borrow occurs here | ----------- mutable borrow occurs here
... ...
LL | &x; LL | &x;
| ^^ immutable borrow occurs here | ^^ immutable borrow occurs here
@ -107,7 +107,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:112:5 --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:112:5
| |
LL | ref foo @ Some(box ref s) => Some(foo), LL | ref foo @ Some(box ref s) => Some(foo),
| ------------------------- immutable borrow occurs here | ------- immutable borrow occurs here
... ...
LL | &mut x; LL | &mut x;
| ^^^^^^ mutable borrow occurs here | ^^^^^^ mutable borrow occurs here
@ -122,7 +122,7 @@ LL | fn bindings_after_at_slice_patterns_or_patterns_moves(x: [Option<Test>; 4])
| - move occurs because `x` has type `[Option<Test>; 4]`, which does not implement the `Copy` trait | - move occurs because `x` has type `[Option<Test>; 4]`, which does not implement the `Copy` trait
LL | match x { LL | match x {
LL | a @ [.., Some(Test::Foo | Test::Bar)] => (), LL | a @ [.., Some(Test::Foo | Test::Bar)] => (),
| ------------------------------------- | -
| | | |
| value moved here | value moved here
| value moved here | value moved here
@ -134,7 +134,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:144:5 --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:144:5
| |
LL | ref a @ [ref b @ .., Some(Test::Foo | Test::Bar)] => Some(a), LL | ref a @ [ref b @ .., Some(Test::Foo | Test::Bar)] => Some(a),
| ------------------------------------------------- immutable borrow occurs here | ----- immutable borrow occurs here
... ...
LL | &mut x; LL | &mut x;
| ^^^^^^ mutable borrow occurs here | ^^^^^^ mutable borrow occurs here
@ -146,7 +146,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:156:5 --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:156:5
| |
LL | ref a @ [ref b @ .., Some(Test::Foo | Test::Bar)] => Some(b), LL | ref a @ [ref b @ .., Some(Test::Foo | Test::Bar)] => Some(b),
| ---------- immutable borrow occurs here | ----- immutable borrow occurs here
... ...
LL | &mut x; LL | &mut x;
| ^^^^^^ mutable borrow occurs here | ^^^^^^ mutable borrow occurs here
@ -158,7 +158,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:170:5 --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:170:5
| |
LL | [_, ref a @ Some(box ref b), ..] => Some(a), LL | [_, ref a @ Some(box ref b), ..] => Some(a),
| ----------------------- immutable borrow occurs here | ----- immutable borrow occurs here
... ...
LL | &mut x; LL | &mut x;
| ^^^^^^ mutable borrow occurs here | ^^^^^^ mutable borrow occurs here
@ -170,7 +170,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:186:5 --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:186:5
| |
LL | [_, ref a @ Some(box Test::Foo | box Test::Bar), ..] => Some(a), LL | [_, ref a @ Some(box Test::Foo | box Test::Bar), ..] => Some(a),
| ------------------------------------------- immutable borrow occurs here | ----- immutable borrow occurs here
... ...
LL | &mut x; LL | &mut x;
| ^^^^^^ mutable borrow occurs here | ^^^^^^ mutable borrow occurs here
@ -182,7 +182,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:200:5 --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:200:5
| |
LL | [_, ref mut a @ Some(box Test::Foo | box Test::Bar), ..] => Some(a), LL | [_, ref mut a @ Some(box Test::Foo | box Test::Bar), ..] => Some(a),
| ----------------------------------------------- mutable borrow occurs here | --------- mutable borrow occurs here
... ...
LL | &x; LL | &x;
| ^^ immutable borrow occurs here | ^^ immutable borrow occurs here
@ -194,7 +194,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:214:5 --> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:214:5
| |
LL | ref a @ [_, ref b @ Some(box Test::Foo | box Test::Bar), ..] => Some(a), LL | ref a @ [_, ref b @ Some(box Test::Foo | box Test::Bar), ..] => Some(a),
| ------------------------------------------------------------ immutable borrow occurs here | ----- immutable borrow occurs here
... ...
LL | &mut x; LL | &mut x;
| ^^^^^^ mutable borrow occurs here | ^^^^^^ mutable borrow occurs here

View file

@ -200,7 +200,7 @@ LL | let x = &mut v;
| ------ borrow of `v` occurs here | ------ borrow of `v` occurs here
LL | match v { LL | match v {
LL | &[x @ ..] => println!("{:?}", x), LL | &[x @ ..] => println!("{:?}", x),
| ^^^^^^ use of borrowed `v` | ^ use of borrowed `v`
... ...
LL | drop(x); LL | drop(x);
| - borrow later used here | - borrow later used here
@ -212,7 +212,7 @@ LL | let x = &mut v;
| ------ borrow of `v` occurs here | ------ borrow of `v` occurs here
... ...
LL | &[_, x @ ..] => println!("{:?}", x), LL | &[_, x @ ..] => println!("{:?}", x),
| ^^^^^^ use of borrowed `v` | ^ use of borrowed `v`
... ...
LL | drop(x); LL | drop(x);
| - borrow later used here | - borrow later used here
@ -224,7 +224,7 @@ LL | let x = &mut v;
| ------ borrow of `v` occurs here | ------ borrow of `v` occurs here
... ...
LL | &[x @ .., _] => println!("{:?}", x), LL | &[x @ .., _] => println!("{:?}", x),
| ^^^^^^ use of borrowed `v` | ^ use of borrowed `v`
... ...
LL | drop(x); LL | drop(x);
| - borrow later used here | - borrow later used here
@ -236,7 +236,7 @@ LL | let x = &mut v;
| ------ borrow of `v` occurs here | ------ borrow of `v` occurs here
... ...
LL | &[_, x @ .., _] => println!("{:?}", x), LL | &[_, x @ .., _] => println!("{:?}", x),
| ^^^^^^ use of borrowed `v` | ^ use of borrowed `v`
... ...
LL | drop(x); LL | drop(x);
| - borrow later used here | - borrow later used here

View file

@ -79,7 +79,7 @@ error[E0382]: use of moved value: `a[..].0`
--> $DIR/borrowck-move-out-from-array-match.rs:89:11 --> $DIR/borrowck-move-out-from-array-match.rs:89:11
| |
LL | [_y @ .., _, _] => {} LL | [_y @ .., _, _] => {}
| ------- value moved here | -- value moved here
... ...
LL | [(_x, _), _, _] => {} LL | [(_x, _), _, _] => {}
| ^^ value used here after move | ^^ value used here after move
@ -90,7 +90,7 @@ error[E0382]: use of moved value: `a[..].0`
--> $DIR/borrowck-move-out-from-array-match.rs:99:15 --> $DIR/borrowck-move-out-from-array-match.rs:99:15
| |
LL | [_, _, _y @ ..] => {} LL | [_, _, _y @ ..] => {}
| ------- value moved here | -- value moved here
... ...
LL | [.., (_x, _)] => {} LL | [.., (_x, _)] => {}
| ^^ value used here after move | ^^ value used here after move
@ -101,7 +101,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-match.rs:110:11 --> $DIR/borrowck-move-out-from-array-match.rs:110:11
| |
LL | [x @ .., _] => {} LL | [x @ .., _] => {}
| ------ value partially moved here | - value partially moved here
LL | } LL | }
LL | match a { LL | match a {
| ^ value used here after partial move | ^ value used here after partial move

View file

@ -68,7 +68,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:85:11 --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:85:11
| |
LL | [_, _y @ ..] => {} LL | [_, _y @ ..] => {}
| ------- value partially moved here | -- value partially moved here
LL | } LL | }
LL | match a { LL | match a {
| ^ value used here after partial move | ^ value used here after partial move
@ -79,7 +79,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:96:11 --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:96:11
| |
LL | [_y @ .., _] => {} LL | [_y @ .., _] => {}
| ------- value partially moved here | -- value partially moved here
LL | } LL | }
LL | match a { LL | match a {
| ^ value used here after partial move | ^ value used here after partial move
@ -90,7 +90,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:109:11 --> $DIR/borrowck-move-out-from-array-no-overlap-match.rs:109:11
| |
LL | [x @ .., _, _] => {} LL | [x @ .., _, _] => {}
| ------ value partially moved here | - value partially moved here
LL | } LL | }
LL | match a { LL | match a {
| ^ value used here after partial move | ^ value used here after partial move

View file

@ -79,7 +79,7 @@ error[E0382]: borrow of moved value: `a[..]`
--> $DIR/borrowck-move-out-from-array-use-match.rs:89:11 --> $DIR/borrowck-move-out-from-array-use-match.rs:89:11
| |
LL | [_y @ .., _, _] => {} LL | [_y @ .., _, _] => {}
| ------- value moved here | -- value moved here
... ...
LL | [(ref _x, _), _, _] => {} LL | [(ref _x, _), _, _] => {}
| ^^^^^^ value borrowed here after move | ^^^^^^ value borrowed here after move
@ -90,7 +90,7 @@ error[E0382]: borrow of moved value: `a[..]`
--> $DIR/borrowck-move-out-from-array-use-match.rs:99:15 --> $DIR/borrowck-move-out-from-array-use-match.rs:99:15
| |
LL | [_, _, _y @ ..] => {} LL | [_, _, _y @ ..] => {}
| ------- value moved here | -- value moved here
... ...
LL | [.., (ref _x, _)] => {} LL | [.., (ref _x, _)] => {}
| ^^^^^^ value borrowed here after move | ^^^^^^ value borrowed here after move
@ -101,7 +101,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-use-match.rs:110:11 --> $DIR/borrowck-move-out-from-array-use-match.rs:110:11
| |
LL | [x @ .., _] => {} LL | [x @ .., _] => {}
| ------ value partially moved here | - value partially moved here
LL | } LL | }
LL | match a { LL | match a {
| ^ value used here after partial move | ^ value used here after partial move
@ -134,7 +134,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-use-match.rs:139:5 --> $DIR/borrowck-move-out-from-array-use-match.rs:139:5
| |
LL | [_, _, _x @ ..] => {} LL | [_, _, _x @ ..] => {}
| ------- value partially moved here | -- value partially moved here
LL | } LL | }
LL | a[0] = Default::default(); LL | a[0] = Default::default();
| ^^^^ value used here after partial move | ^^^^ value used here after partial move
@ -145,7 +145,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-use-match.rs:147:5 --> $DIR/borrowck-move-out-from-array-use-match.rs:147:5
| |
LL | [_, _, _x @ ..] => {} LL | [_, _, _x @ ..] => {}
| ------- value partially moved here | -- value partially moved here
LL | } LL | }
LL | a[0].1 = Default::default(); LL | a[0].1 = Default::default();
| ^^^^ value used here after partial move | ^^^^ value used here after partial move

View file

@ -68,7 +68,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:85:11 --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:85:11
| |
LL | [_, _y @ ..] => {} LL | [_, _y @ ..] => {}
| ------- value partially moved here | -- value partially moved here
LL | } LL | }
LL | match a { LL | match a {
| ^ value used here after partial move | ^ value used here after partial move
@ -79,7 +79,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:96:11 --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:96:11
| |
LL | [_y @ .., _] => {} LL | [_y @ .., _] => {}
| ------- value partially moved here | -- value partially moved here
LL | } LL | }
LL | match a { LL | match a {
| ^ value used here after partial move | ^ value used here after partial move
@ -90,7 +90,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:109:11 --> $DIR/borrowck-move-out-from-array-use-no-overlap-match.rs:109:11
| |
LL | [x @ .., _, _] => {} LL | [x @ .., _, _] => {}
| ------ value partially moved here | - value partially moved here
LL | } LL | }
LL | match a { LL | match a {
| ^ value used here after partial move | ^ value used here after partial move

View file

@ -34,7 +34,7 @@ error[E0382]: borrow of partially moved value: `a`
LL | let [_x, _, _] = a; LL | let [_x, _, _] = a;
| -- value partially moved here | -- value partially moved here
LL | let [ref _y @ .., _, _] = a; LL | let [ref _y @ .., _, _] = a;
| ^^^^^^^^^^^ value borrowed here after partial move | ^^^^^^ value borrowed here after partial move
| |
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
@ -44,7 +44,7 @@ error[E0382]: borrow of partially moved value: `a`
LL | let [.., _x] = a; LL | let [.., _x] = a;
| -- value partially moved here | -- value partially moved here
LL | let [_, _, ref _y @ ..] = a; LL | let [_, _, ref _y @ ..] = a;
| ^^^^^^^^^^^ value borrowed here after partial move | ^^^^^^ value borrowed here after partial move
| |
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
@ -54,7 +54,7 @@ error[E0382]: borrow of partially moved value: `a`
LL | let [(_x, _), _, _] = a; LL | let [(_x, _), _, _] = a;
| -- value partially moved here | -- value partially moved here
LL | let [ref _y @ .., _, _] = a; LL | let [ref _y @ .., _, _] = a;
| ^^^^^^^^^^^ value borrowed here after partial move | ^^^^^^ value borrowed here after partial move
| |
= note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
@ -64,7 +64,7 @@ error[E0382]: borrow of partially moved value: `a`
LL | let [.., (_x, _)] = a; LL | let [.., (_x, _)] = a;
| -- value partially moved here | -- value partially moved here
LL | let [_, _, ref _y @ ..] = a; LL | let [_, _, ref _y @ ..] = a;
| ^^^^^^^^^^^ value borrowed here after partial move | ^^^^^^ value borrowed here after partial move
| |
= note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
@ -72,7 +72,7 @@ error[E0382]: borrow of moved value: `a[..]`
--> $DIR/borrowck-move-out-from-array-use.rs:54:11 --> $DIR/borrowck-move-out-from-array-use.rs:54:11
| |
LL | let [_y @ .., _, _] = a; LL | let [_y @ .., _, _] = a;
| ------- value moved here | -- value moved here
LL | let [(ref _x, _), _, _] = a; LL | let [(ref _x, _), _, _] = a;
| ^^^^^^ value borrowed here after move | ^^^^^^ value borrowed here after move
| |
@ -82,7 +82,7 @@ error[E0382]: borrow of moved value: `a[..]`
--> $DIR/borrowck-move-out-from-array-use.rs:60:15 --> $DIR/borrowck-move-out-from-array-use.rs:60:15
| |
LL | let [_, _, _y @ ..] = a; LL | let [_, _, _y @ ..] = a;
| ------- value moved here | -- value moved here
LL | let [.., (ref _x, _)] = a; LL | let [.., (ref _x, _)] = a;
| ^^^^^^ value borrowed here after move | ^^^^^^ value borrowed here after move
| |
@ -92,9 +92,9 @@ error[E0382]: borrow of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-use.rs:68:13 --> $DIR/borrowck-move-out-from-array-use.rs:68:13
| |
LL | let [x @ .., _] = a; LL | let [x @ .., _] = a;
| ------ value partially moved here | - value partially moved here
LL | let [_, ref _y @ ..] = a; LL | let [_, ref _y @ ..] = a;
| ^^^^^^^^^^^ value borrowed here after partial move | ^^^^^^ value borrowed here after partial move
| |
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
@ -122,7 +122,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-use.rs:88:5 --> $DIR/borrowck-move-out-from-array-use.rs:88:5
| |
LL | let [_, _, _x @ ..] = a; LL | let [_, _, _x @ ..] = a;
| ------- value partially moved here | -- value partially moved here
LL | a[0] = Default::default(); LL | a[0] = Default::default();
| ^^^^ value used here after partial move | ^^^^ value used here after partial move
| |
@ -132,7 +132,7 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array-use.rs:94:5 --> $DIR/borrowck-move-out-from-array-use.rs:94:5
| |
LL | let [_, _, _x @ ..] = a; LL | let [_, _, _x @ ..] = a;
| ------- value partially moved here | -- value partially moved here
LL | a[0].1 = Default::default(); LL | a[0].1 = Default::default();
| ^^^^ value used here after partial move | ^^^^ value used here after partial move
| |

View file

@ -34,7 +34,7 @@ error[E0382]: use of partially moved value: `a`
LL | let [_x, _, _] = a; LL | let [_x, _, _] = a;
| -- value partially moved here | -- value partially moved here
LL | let [_y @ .., _, _] = a; LL | let [_y @ .., _, _] = a;
| ^^^^^^^ value used here after partial move | ^^ value used here after partial move
| |
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
@ -44,7 +44,7 @@ error[E0382]: use of partially moved value: `a`
LL | let [.., _x] = a; LL | let [.., _x] = a;
| -- value partially moved here | -- value partially moved here
LL | let [_, _, _y @ ..] = a; LL | let [_, _, _y @ ..] = a;
| ^^^^^^^ value used here after partial move | ^^ value used here after partial move
| |
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait
@ -54,7 +54,7 @@ error[E0382]: use of partially moved value: `a`
LL | let [(_x, _), _, _] = a; LL | let [(_x, _), _, _] = a;
| -- value partially moved here | -- value partially moved here
LL | let [_y @ .., _, _] = a; LL | let [_y @ .., _, _] = a;
| ^^^^^^^ value used here after partial move | ^^ value used here after partial move
| |
= note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
@ -64,7 +64,7 @@ error[E0382]: use of partially moved value: `a`
LL | let [.., (_x, _)] = a; LL | let [.., (_x, _)] = a;
| -- value partially moved here | -- value partially moved here
LL | let [_, _, _y @ ..] = a; LL | let [_, _, _y @ ..] = a;
| ^^^^^^^ value used here after partial move | ^^ value used here after partial move
| |
= note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait = note: partial move occurs because `a[..].0` has type `String`, which does not implement the `Copy` trait
@ -72,7 +72,7 @@ error[E0382]: use of moved value: `a[..].0`
--> $DIR/borrowck-move-out-from-array.rs:54:11 --> $DIR/borrowck-move-out-from-array.rs:54:11
| |
LL | let [_y @ .., _, _] = a; LL | let [_y @ .., _, _] = a;
| ------- value moved here | -- value moved here
LL | let [(_x, _), _, _] = a; LL | let [(_x, _), _, _] = a;
| ^^ value used here after move | ^^ value used here after move
| |
@ -82,7 +82,7 @@ error[E0382]: use of moved value: `a[..].0`
--> $DIR/borrowck-move-out-from-array.rs:60:15 --> $DIR/borrowck-move-out-from-array.rs:60:15
| |
LL | let [_, _, _y @ ..] = a; LL | let [_, _, _y @ ..] = a;
| ------- value moved here | -- value moved here
LL | let [.., (_x, _)] = a; LL | let [.., (_x, _)] = a;
| ^^ value used here after move | ^^ value used here after move
| |
@ -92,9 +92,9 @@ error[E0382]: use of partially moved value: `a`
--> $DIR/borrowck-move-out-from-array.rs:68:13 --> $DIR/borrowck-move-out-from-array.rs:68:13
| |
LL | let [x @ .., _] = a; LL | let [x @ .., _] = a;
| ------ value partially moved here | - value partially moved here
LL | let [_, _y @ ..] = a; LL | let [_, _y @ ..] = a;
| ^^^^^^^ value used here after partial move | ^^ value used here after partial move
| |
= note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait = note: partial move occurs because `a[..]` has type `(String, String)`, which does not implement the `Copy` trait

View file

@ -57,7 +57,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im
LL | let [ref first, ref second, ..] = *s; LL | let [ref first, ref second, ..] = *s;
| ---------- immutable borrow occurs here | ---------- immutable borrow occurs here
LL | let [_, ref mut tail @ ..] = *s; LL | let [_, ref mut tail @ ..] = *s;
| ^^^^^^^^^^^^^^^^^ mutable borrow occurs here | ^^^^^^^^^^^^ mutable borrow occurs here
LL | nop(&[first, second]); LL | nop(&[first, second]);
| ------ immutable borrow later used here | ------ immutable borrow later used here
@ -67,7 +67,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im
LL | let [.., ref second, ref first] = *s; LL | let [.., ref second, ref first] = *s;
| ---------- immutable borrow occurs here | ---------- immutable borrow occurs here
LL | let [ref mut tail @ .., _] = *s; LL | let [ref mut tail @ .., _] = *s;
| ^^^^^^^^^^^^^^^^^ mutable borrow occurs here | ^^^^^^^^^^^^ mutable borrow occurs here
LL | nop(&[first, second]); LL | nop(&[first, second]);
| ------ immutable borrow later used here | ------ immutable borrow later used here
@ -75,9 +75,9 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im
--> $DIR/borrowck-slice-pattern-element-loan-array.rs:46:10 --> $DIR/borrowck-slice-pattern-element-loan-array.rs:46:10
| |
LL | let [_, ref s1 @ ..] = *s; LL | let [_, ref s1 @ ..] = *s;
| ----------- immutable borrow occurs here | ------ immutable borrow occurs here
LL | let [ref mut s2 @ .., _, _] = *s; LL | let [ref mut s2 @ .., _, _] = *s;
| ^^^^^^^^^^^^^^^ mutable borrow occurs here | ^^^^^^^^^^ mutable borrow occurs here
LL | nop_subslice(s1); LL | nop_subslice(s1);
| -- immutable borrow later used here | -- immutable borrow later used here

View file

@ -88,7 +88,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im
LL | if let [ref first, ref second, ..] = *s { LL | if let [ref first, ref second, ..] = *s {
| ---------- immutable borrow occurs here | ---------- immutable borrow occurs here
LL | if let [_, ref mut tail @ ..] = *s { LL | if let [_, ref mut tail @ ..] = *s {
| ^^^^^^^^^^^^^^^^^ mutable borrow occurs here | ^^^^^^^^^^^^ mutable borrow occurs here
LL | nop(&[first, second]); LL | nop(&[first, second]);
| ------ immutable borrow later used here | ------ immutable borrow later used here
@ -98,7 +98,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im
LL | if let [.., ref second, ref first] = *s { LL | if let [.., ref second, ref first] = *s {
| ---------- immutable borrow occurs here | ---------- immutable borrow occurs here
LL | if let [ref mut tail @ .., _] = *s { LL | if let [ref mut tail @ .., _] = *s {
| ^^^^^^^^^^^^^^^^^ mutable borrow occurs here | ^^^^^^^^^^^^ mutable borrow occurs here
LL | nop(&[first, second]); LL | nop(&[first, second]);
| ------ immutable borrow later used here | ------ immutable borrow later used here
@ -106,9 +106,9 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im
--> $DIR/borrowck-slice-pattern-element-loan-slice.rs:65:17 --> $DIR/borrowck-slice-pattern-element-loan-slice.rs:65:17
| |
LL | if let [_, _, _, ref s1 @ ..] = *s { LL | if let [_, _, _, ref s1 @ ..] = *s {
| ----------- immutable borrow occurs here | ------ immutable borrow occurs here
LL | if let [ref mut s2 @ .., _, _, _] = *s { LL | if let [ref mut s2 @ .., _, _, _] = *s {
| ^^^^^^^^^^^^^^^ mutable borrow occurs here | ^^^^^^^^^^ mutable borrow occurs here
LL | nop_subslice(s1); LL | nop_subslice(s1);
| -- immutable borrow later used here | -- immutable borrow later used here

View file

@ -2,7 +2,7 @@ error[E0506]: cannot assign to `a[_]` because it is borrowed
--> $DIR/borrowck-vec-pattern-move-tail.rs:8:5 --> $DIR/borrowck-vec-pattern-move-tail.rs:8:5
| |
LL | [1, 2, ref tail @ ..] => tail, LL | [1, 2, ref tail @ ..] => tail,
| ------------- borrow of `a[_]` occurs here | -------- borrow of `a[_]` occurs here
... ...
LL | a[2] = 0; LL | a[2] = 0;
| ^^^^^^^^ assignment to borrowed `a[_]` occurs here | ^^^^^^^^ assignment to borrowed `a[_]` occurs here

View file

@ -14,7 +14,7 @@ error[E0506]: cannot assign to `vec[_]` because it is borrowed
--> $DIR/borrowck-vec-pattern-nesting.rs:23:13 --> $DIR/borrowck-vec-pattern-nesting.rs:23:13
| |
LL | &mut [ref _b @ ..] => { LL | &mut [ref _b @ ..] => {
| ----------- borrow of `vec[_]` occurs here | ------ borrow of `vec[_]` occurs here
LL | LL |
LL | vec[0] = Box::new(4); LL | vec[0] = Box::new(4);
| ^^^^^^ assignment to borrowed `vec[_]` occurs here | ^^^^^^ assignment to borrowed `vec[_]` occurs here

View file

@ -13,7 +13,7 @@ error[E0508]: cannot move out of type `[D; 4]`, a non-copy array
--> $DIR/move-out-of-array-ref.rs:13:27 --> $DIR/move-out-of-array-ref.rs:13:27
| |
LL | let [_, s @ .. , _] = *a; LL | let [_, s @ .. , _] = *a;
| ------ ^^ | - ^^
| | | | | |
| | cannot move out of here | | cannot move out of here
| | help: consider borrowing here: `&*a` | | help: consider borrowing here: `&*a`
@ -35,7 +35,7 @@ error[E0508]: cannot move out of type `[D; 4]`, a non-copy array
--> $DIR/move-out-of-array-ref.rs:23:27 --> $DIR/move-out-of-array-ref.rs:23:27
| |
LL | let [_, s @ .. , _] = *a; LL | let [_, s @ .. , _] = *a;
| ------ ^^ | - ^^
| | | | | |
| | cannot move out of here | | cannot move out of here
| | help: consider borrowing here: `&*a` | | help: consider borrowing here: `&*a`

View file

@ -14,7 +14,7 @@ LL | match *a {
| ^^ cannot move out of here | ^^ cannot move out of here
LL | LL |
LL | [a @ ..] => {} LL | [a @ ..] => {}
| ------ | -
| | | |
| data moved here | data moved here
| move occurs because `a` has type `[A]`, which does not implement the `Copy` trait | move occurs because `a` has type `[A]`, which does not implement the `Copy` trait
@ -26,7 +26,7 @@ LL | match *b {
| ^^ cannot move out of here | ^^ cannot move out of here
LL | LL |
LL | [_, _, b @ .., _] => {} LL | [_, _, b @ .., _] => {}
| ------ | -
| | | |
| data moved here | data moved here
| move occurs because `b` has type `[A]`, which does not implement the `Copy` trait | move occurs because `b` has type `[A]`, which does not implement the `Copy` trait
@ -38,7 +38,7 @@ LL | match *c {
| ^^ cannot move out of here | ^^ cannot move out of here
LL | LL |
LL | [c @ ..] => {} LL | [c @ ..] => {}
| ------ | -
| | | |
| data moved here | data moved here
| move occurs because `c` has type `[C]`, which does not implement the `Copy` trait | move occurs because `c` has type `[C]`, which does not implement the `Copy` trait
@ -50,7 +50,7 @@ LL | match *d {
| ^^ cannot move out of here | ^^ cannot move out of here
LL | LL |
LL | [_, _, d @ .., _] => {} LL | [_, _, d @ .., _] => {}
| ------ | -
| | | |
| data moved here | data moved here
| move occurs because `d` has type `[C]`, which does not implement the `Copy` trait | move occurs because `d` has type `[C]`, which does not implement the `Copy` trait

View file

@ -2,7 +2,7 @@ error[E0594]: cannot assign to `*my_ref`, which is behind a `&` reference
--> $DIR/issue-51244.rs:3:5 --> $DIR/issue-51244.rs:3:5
| |
LL | let ref my_ref @ _ = 0; LL | let ref my_ref @ _ = 0;
| -------------- help: consider changing this to be a mutable reference: `ref mut my_ref @ _` | ---------- help: consider changing this to be a mutable reference: `ref mut my_ref`
LL | *my_ref = 0; LL | *my_ref = 0;
| ^^^^^^^^^^^ `my_ref` is a `&` reference, so the data it refers to cannot be written | ^^^^^^^^^^^ `my_ref` is a `&` reference, so the data it refers to cannot be written

View file

@ -40,9 +40,8 @@ error[E0382]: borrow of moved value
--> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:12:14 --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:12:14
| |
LL | Some(ref _y @ _z) => {} LL | Some(ref _y @ _z) => {}
| ^^^^^^^^^-- | ^^^^^^ -- value moved here
| | | | |
| | value moved here
| value borrowed here after move | value borrowed here after move
| |
= note: move occurs because value has type `X`, which does not implement the `Copy` trait = note: move occurs because value has type `X`, which does not implement the `Copy` trait
@ -55,9 +54,8 @@ error[E0382]: borrow of moved value
--> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:26:14 --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-1.rs:26:14
| |
LL | Some(ref mut _y @ _z) => {} LL | Some(ref mut _y @ _z) => {}
| ^^^^^^^^^^^^^-- | ^^^^^^^^^^ -- value moved here
| | | | |
| | value moved here
| value borrowed here after move | value borrowed here after move
| |
= note: move occurs because value has type `X`, which does not implement the `Copy` trait = note: move occurs because value has type `X`, which does not implement the `Copy` trait

View file

@ -2,9 +2,8 @@ error[E0382]: use of partially moved value
--> $DIR/bind-by-move-no-subbindings-fun-param.rs:7:6 --> $DIR/bind-by-move-no-subbindings-fun-param.rs:7:6
| |
LL | fn f(a @ A(u): A) -> Box<u8> { LL | fn f(a @ A(u): A) -> Box<u8> {
| ^^^^^^-^ | ^ - value partially moved here
| | | | |
| | value partially moved here
| value used here after partial move | value used here after partial move
| |
= note: partial move occurs because value has type `Box<u8>`, which does not implement the `Copy` trait = note: partial move occurs because value has type `Box<u8>`, which does not implement the `Copy` trait

View file

@ -2,7 +2,7 @@ error[E0382]: use of moved value
--> $DIR/borrowck-move-and-move.rs:11:9 --> $DIR/borrowck-move-and-move.rs:11:9
| |
LL | let a @ b = U; LL | let a @ b = U;
| ^^^^- - move occurs because value has type `U`, which does not implement the `Copy` trait | ^ - - move occurs because value has type `U`, which does not implement the `Copy` trait
| | | | | |
| | value moved here | | value moved here
| value used here after move | value used here after move
@ -11,9 +11,8 @@ error[E0382]: use of partially moved value
--> $DIR/borrowck-move-and-move.rs:13:9 --> $DIR/borrowck-move-and-move.rs:13:9
| |
LL | let a @ (b, c) = (U, U); LL | let a @ (b, c) = (U, U);
| ^^^^^^^^-^ | ^ - value partially moved here
| | | | |
| | value partially moved here
| value used here after partial move | value used here after partial move
| |
= note: partial move occurs because value has type `U`, which does not implement the `Copy` trait = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait
@ -22,9 +21,8 @@ error[E0382]: use of partially moved value
--> $DIR/borrowck-move-and-move.rs:15:9 --> $DIR/borrowck-move-and-move.rs:15:9
| |
LL | let a @ (b, c) = (u(), u()); LL | let a @ (b, c) = (u(), u());
| ^^^^^^^^-^ | ^ - value partially moved here
| | | | |
| | value partially moved here
| value used here after partial move | value used here after partial move
| |
= note: partial move occurs because value has type `U`, which does not implement the `Copy` trait = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait
@ -35,9 +33,8 @@ error[E0382]: use of moved value
LL | match Ok(U) { LL | match Ok(U) {
| ----- move occurs because value has type `Result<U, U>`, which does not implement the `Copy` trait | ----- move occurs because value has type `Result<U, U>`, which does not implement the `Copy` trait
LL | a @ Ok(b) | a @ Err(b) => {} LL | a @ Ok(b) | a @ Err(b) => {}
| -------^- | - ^ value used here after move
| | | | |
| | value used here after move
| value moved here | value moved here
error[E0382]: use of moved value error[E0382]: use of moved value
@ -46,18 +43,16 @@ error[E0382]: use of moved value
LL | match Ok(U) { LL | match Ok(U) {
| ----- move occurs because value has type `Result<U, U>`, which does not implement the `Copy` trait | ----- move occurs because value has type `Result<U, U>`, which does not implement the `Copy` trait
LL | a @ Ok(b) | a @ Err(b) => {} LL | a @ Ok(b) | a @ Err(b) => {}
| --------^- | - ^ value used here after move
| | | | |
| | value used here after move
| value moved here | value moved here
error[E0382]: use of partially moved value error[E0382]: use of partially moved value
--> $DIR/borrowck-move-and-move.rs:25:9 --> $DIR/borrowck-move-and-move.rs:25:9
| |
LL | xs @ [a, .., b] => {} LL | xs @ [a, .., b] => {}
| ^^^^^^^^^^^^^-^ | ^^ - value partially moved here
| | | | |
| | value partially moved here
| value used here after partial move | value used here after partial move
| |
= note: partial move occurs because value has type `U`, which does not implement the `Copy` trait = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait
@ -66,9 +61,8 @@ error[E0382]: use of partially moved value
--> $DIR/borrowck-move-and-move.rs:29:9 --> $DIR/borrowck-move-and-move.rs:29:9
| |
LL | xs @ [_, ys @ .., _] => {} LL | xs @ [_, ys @ .., _] => {}
| ^^^^^^^^^-------^^^^ | ^^ -- value partially moved here
| | | | |
| | value partially moved here
| value used here after partial move | value used here after partial move
| |
= note: partial move occurs because value has type `U`, which does not implement the `Copy` trait = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait
@ -77,7 +71,7 @@ error[E0382]: use of moved value
--> $DIR/borrowck-move-and-move.rs:22:12 --> $DIR/borrowck-move-and-move.rs:22:12
| |
LL | fn fun(a @ b: U) {} LL | fn fun(a @ b: U) {}
| ^^^^- | ^----
| | | | | |
| | value moved here | | value moved here
| value used here after move | value used here after move

View file

@ -74,9 +74,8 @@ error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-at-and-box.rs:31:9 --> $DIR/borrowck-pat-at-and-box.rs:31:9
| |
LL | let ref a @ box b = Box::new(NC); LL | let ref a @ box b = Box::new(NC);
| ^^^^^^^^^^^^- | ^^^^^ - value moved here
| | | | |
| | value moved here
| value borrowed here after move | value borrowed here after move
| |
= note: move occurs because value has type `NC`, which does not implement the `Copy` trait = note: move occurs because value has type `NC`, which does not implement the `Copy` trait
@ -85,9 +84,8 @@ error[E0502]: cannot borrow value as immutable because it is also borrowed as mu
--> $DIR/borrowck-pat-at-and-box.rs:38:9 --> $DIR/borrowck-pat-at-and-box.rs:38:9
| |
LL | let ref a @ box ref mut b = Box::new(NC); LL | let ref a @ box ref mut b = Box::new(NC);
| ^^^^^^^^^^^^--------- | ^^^^^ --------- mutable borrow occurs here
| | | | |
| | mutable borrow occurs here
| immutable borrow occurs here | immutable borrow occurs here
... ...
LL | *b = NC; LL | *b = NC;
@ -97,9 +95,8 @@ error[E0502]: cannot borrow value as immutable because it is also borrowed as mu
--> $DIR/borrowck-pat-at-and-box.rs:42:9 --> $DIR/borrowck-pat-at-and-box.rs:42:9
| |
LL | let ref a @ box ref mut b = Box::new(NC); LL | let ref a @ box ref mut b = Box::new(NC);
| ^^^^^^^^^^^^--------- | ^^^^^ --------- mutable borrow occurs here
| | | | |
| | mutable borrow occurs here
| immutable borrow occurs here | immutable borrow occurs here
... ...
LL | *b = NC; LL | *b = NC;
@ -109,9 +106,8 @@ error[E0502]: cannot borrow value as mutable because it is also borrowed as immu
--> $DIR/borrowck-pat-at-and-box.rs:48:9 --> $DIR/borrowck-pat-at-and-box.rs:48:9
| |
LL | let ref mut a @ box ref b = Box::new(NC); LL | let ref mut a @ box ref b = Box::new(NC);
| ^^^^^^^^^^^^^^^^----- | ^^^^^^^^^ ----- immutable borrow occurs here
| | | | |
| | immutable borrow occurs here
| mutable borrow occurs here | mutable borrow occurs here
... ...
LL | drop(b); LL | drop(b);
@ -121,9 +117,8 @@ error[E0502]: cannot borrow value as mutable because it is also borrowed as immu
--> $DIR/borrowck-pat-at-and-box.rs:62:9 --> $DIR/borrowck-pat-at-and-box.rs:62:9
| |
LL | ref mut a @ box ref b => { LL | ref mut a @ box ref b => {
| ^^^^^^^^^^^^^^^^----- | ^^^^^^^^^ ----- immutable borrow occurs here
| | | | |
| | immutable borrow occurs here
| mutable borrow occurs here | mutable borrow occurs here
... ...
LL | drop(b); LL | drop(b);
@ -133,9 +128,8 @@ error[E0502]: cannot borrow value as mutable because it is also borrowed as immu
--> $DIR/borrowck-pat-at-and-box.rs:54:11 --> $DIR/borrowck-pat-at-and-box.rs:54:11
| |
LL | fn f5(ref mut a @ box ref b: Box<NC>) { LL | fn f5(ref mut a @ box ref b: Box<NC>) {
| ^^^^^^^^^^^^^^^^----- | ^^^^^^^^^ ----- immutable borrow occurs here
| | | | |
| | immutable borrow occurs here
| mutable borrow occurs here | mutable borrow occurs here
... ...
LL | drop(b); LL | drop(b);

View file

@ -262,9 +262,8 @@ error[E0382]: use of partially moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:9 --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:24:9
| |
LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U); LL | let a @ (mut b @ ref mut c, d @ ref e) = (U, U);
| ^^^^^^^^^^^^^^^^^^^^^^^^---------^ | ^ - value partially moved here
| | | | |
| | value partially moved here
| value used here after partial move | value used here after partial move
| |
= note: partial move occurs because value has type `U`, which does not implement the `Copy` trait = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait
@ -273,9 +272,8 @@ error[E0382]: use of partially moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:33:9 --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:33:9
| |
LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u()); LL | let a @ (mut b @ ref mut c, d @ ref e) = (u(), u());
| ^^^^^^^^^^^^^^^^^^^^^^^^---------^ | ^ - value partially moved here
| | | | |
| | value partially moved here
| value used here after partial move | value used here after partial move
| |
= note: partial move occurs because value has type `U`, which does not implement the `Copy` trait = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait
@ -286,10 +284,7 @@ error[E0382]: use of moved value
LL | match Some((U, U)) { LL | match Some((U, U)) {
| ------------ move occurs because value has type `Option<(U, U)>`, which does not implement the `Copy` trait | ------------ move occurs because value has type `Option<(U, U)>`, which does not implement the `Copy` trait
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| -----------------------------^^^^^^^^^-- | - value moved here ^ value used here after move
| | |
| | value used here after move
| value moved here
error[E0382]: borrow of moved value error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:55:30 --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:55:30
@ -297,9 +292,8 @@ error[E0382]: borrow of moved value
LL | match Some([U, U]) { LL | match Some([U, U]) {
| ------------ move occurs because value has type `Option<[U; 2]>`, which does not implement the `Copy` trait | ------------ move occurs because value has type `Option<[U; 2]>`, which does not implement the `Copy` trait
LL | mut a @ Some([ref b, ref mut c]) => {} LL | mut a @ Some([ref b, ref mut c]) => {}
| ---------------------^^^^^^^^^-- | ----- ^^^^^^^^^ value borrowed here after move
| | | | |
| | value borrowed here after move
| value moved here | value moved here
error[E0382]: borrow of moved value error[E0382]: borrow of moved value
@ -308,9 +302,8 @@ error[E0382]: borrow of moved value
LL | match Some(u()) { LL | match Some(u()) {
| --------- move occurs because value has type `Option<U>`, which does not implement the `Copy` trait | --------- move occurs because value has type `Option<U>`, which does not implement the `Copy` trait
LL | a @ Some(ref b) => {} LL | a @ Some(ref b) => {}
| ---------^^^^^- | - ^^^^^ value borrowed here after move
| | | | |
| | value borrowed here after move
| value moved here | value moved here
error[E0382]: use of moved value error[E0382]: use of moved value
@ -319,10 +312,7 @@ error[E0382]: use of moved value
LL | match Some((u(), u())) { LL | match Some((u(), u())) {
| ---------------- move occurs because value has type `Option<(U, U)>`, which does not implement the `Copy` trait | ---------------- move occurs because value has type `Option<(U, U)>`, which does not implement the `Copy` trait
LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {} LL | a @ Some((mut b @ ref mut c, d @ ref e)) => {}
| -----------------------------^^^^^^^^^-- | - value moved here ^ value used here after move
| | |
| | value used here after move
| value moved here
error[E0382]: borrow of moved value error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:75:30 --> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:75:30
@ -330,18 +320,16 @@ error[E0382]: borrow of moved value
LL | match Some([u(), u()]) { LL | match Some([u(), u()]) {
| ---------------- move occurs because value has type `Option<[U; 2]>`, which does not implement the `Copy` trait | ---------------- move occurs because value has type `Option<[U; 2]>`, which does not implement the `Copy` trait
LL | mut a @ Some([ref b, ref mut c]) => {} LL | mut a @ Some([ref b, ref mut c]) => {}
| ---------------------^^^^^^^^^-- | ----- ^^^^^^^^^ value borrowed here after move
| | | | |
| | value borrowed here after move
| value moved here | value moved here
error[E0382]: use of partially moved value error[E0382]: use of partially moved value
--> $DIR/borrowck-pat-by-move-and-ref-inverse.rs:14:11 --> $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)) {} LL | fn f2(mut a @ (b @ ref c, mut d @ ref e): (U, U)) {}
| ^^^^^^^^^^^^^^^^^^^^-------------^ | ^^^^^ ----- value partially moved here
| | | | |
| | value partially moved here
| value used here after partial move | value used here after partial move
| |
= note: partial move occurs because value has type `U`, which does not implement the `Copy` trait = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait

View file

@ -237,9 +237,8 @@ error[E0382]: borrow of partially moved value
--> $DIR/borrowck-pat-by-move-and-ref.rs:30:9 --> $DIR/borrowck-pat-by-move-and-ref.rs:30:9
| |
LL | let ref mut a @ [b, mut c] = [U, U]; LL | let ref mut a @ [b, mut c] = [U, U];
| ^^^^^^^^^^^^^^^^-----^ | ^^^^^^^^^ ----- value partially moved here
| | | | |
| | value partially moved here
| value borrowed here after partial move | value borrowed here after partial move
| |
= note: partial move occurs because value has type `U`, which does not implement the `Copy` trait = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait
@ -248,7 +247,7 @@ error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref.rs:33:9 --> $DIR/borrowck-pat-by-move-and-ref.rs:33:9
| |
LL | let ref a @ b = u(); LL | let ref a @ b = u();
| ^^^^^^^^- --- move occurs because value has type `U`, which does not implement the `Copy` trait | ^^^^^ - --- move occurs because value has type `U`, which does not implement the `Copy` trait
| | | | | |
| | value moved here | | value moved here
| value borrowed here after move | value borrowed here after move
@ -257,9 +256,8 @@ error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref.rs:36:18 --> $DIR/borrowck-pat-by-move-and-ref.rs:36:18
| |
LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u()); LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u());
| ^^^^^^^^----- | ^^^^^ ----- value moved here
| | | | |
| | value moved here
| value borrowed here after move | value borrowed here after move
| |
= note: move occurs because value has type `U`, which does not implement the `Copy` trait = note: move occurs because value has type `U`, which does not implement the `Copy` trait
@ -268,9 +266,8 @@ error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref.rs:36:33 --> $DIR/borrowck-pat-by-move-and-ref.rs:36:33
| |
LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u()); LL | let ref a @ (ref b @ mut c, ref d @ e) = (u(), u());
| ^^^^^^^^- | ^^^^^ - value moved here
| | | | |
| | value moved here
| value borrowed here after move | value borrowed here after move
| |
= note: move occurs because value has type `U`, which does not implement the `Copy` trait = note: move occurs because value has type `U`, which does not implement the `Copy` trait
@ -279,9 +276,8 @@ error[E0382]: borrow of partially moved value
--> $DIR/borrowck-pat-by-move-and-ref.rs:42:9 --> $DIR/borrowck-pat-by-move-and-ref.rs:42:9
| |
LL | let ref mut a @ [b, mut c] = [u(), u()]; LL | let ref mut a @ [b, mut c] = [u(), u()];
| ^^^^^^^^^^^^^^^^-----^ | ^^^^^^^^^ ----- value partially moved here
| | | | |
| | value partially moved here
| value borrowed here after partial move | value borrowed here after partial move
| |
= note: partial move occurs because value has type `U`, which does not implement the `Copy` trait = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait
@ -290,9 +286,8 @@ error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref.rs:69:23 --> $DIR/borrowck-pat-by-move-and-ref.rs:69:23
| |
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
| ^^^^^^^^----- | ^^^^^ ----- value moved here
| | | | |
| | value moved here
| value borrowed here after move | value borrowed here after move
| |
= note: move occurs because value has type `U`, which does not implement the `Copy` trait = note: move occurs because value has type `U`, which does not implement the `Copy` trait
@ -305,9 +300,8 @@ error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref.rs:69:38 --> $DIR/borrowck-pat-by-move-and-ref.rs:69:38
| |
LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {} LL | ref a @ Some((ref b @ mut c, ref d @ e)) => {}
| ^^^^^^^^- | ^^^^^ - value moved here
| | | | |
| | value moved here
| value borrowed here after move | value borrowed here after move
| |
= note: move occurs because value has type `U`, which does not implement the `Copy` trait = note: move occurs because value has type `U`, which does not implement the `Copy` trait
@ -320,7 +314,7 @@ error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref.rs:11:11 --> $DIR/borrowck-pat-by-move-and-ref.rs:11:11
| |
LL | fn f1(ref a @ b: U) {} LL | fn f1(ref a @ b: U) {}
| ^^^^^^^^- | ^^^^^----
| | | | | |
| | value moved here | | value moved here
| value borrowed here after move | value borrowed here after move
@ -330,9 +324,8 @@ error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref.rs:14:20 --> $DIR/borrowck-pat-by-move-and-ref.rs:14:20
| |
LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {} LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {}
| ^^^^^^^^----- | ^^^^^ ----- value moved here
| | | | |
| | value moved here
| value borrowed here after move | value borrowed here after move
| |
= note: move occurs because value has type `U`, which does not implement the `Copy` trait = note: move occurs because value has type `U`, which does not implement the `Copy` trait
@ -341,9 +334,8 @@ error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-by-move-and-ref.rs:14:35 --> $DIR/borrowck-pat-by-move-and-ref.rs:14:35
| |
LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {} LL | fn f2(ref a @ (ref b @ mut c, ref d @ e): (U, U)) {}
| ^^^^^^^^- | ^^^^^ - value moved here
| | | | |
| | value moved here
| value borrowed here after move | value borrowed here after move
| |
= note: move occurs because value has type `U`, which does not implement the `Copy` trait = note: move occurs because value has type `U`, which does not implement the `Copy` trait
@ -352,9 +344,8 @@ error[E0382]: borrow of partially moved value
--> $DIR/borrowck-pat-by-move-and-ref.rs:20:11 --> $DIR/borrowck-pat-by-move-and-ref.rs:20:11
| |
LL | fn f3(ref mut a @ [b, mut c]: [U; 2]) {} LL | fn f3(ref mut a @ [b, mut c]: [U; 2]) {}
| ^^^^^^^^^^^^^^^^-----^ | ^^^^^^^^^ ----- value partially moved here
| | | | |
| | value partially moved here
| value borrowed here after partial move | value borrowed here after partial move
| |
= note: partial move occurs because value has type `U`, which does not implement the `Copy` trait = note: partial move occurs because value has type `U`, which does not implement the `Copy` trait

View file

@ -298,9 +298,8 @@ error[E0502]: cannot borrow value as immutable because it is also borrowed as mu
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:8:31 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:8:31
| |
LL | ref mut z @ &mut Some(ref a) => { LL | ref mut z @ &mut Some(ref a) => {
| ----------------------^^^^^- | --------- ^^^^^ immutable borrow occurs here
| | | | |
| | immutable borrow occurs here
| mutable borrow occurs here | mutable borrow occurs here
... ...
LL | **z = None; LL | **z = None;
@ -310,9 +309,8 @@ error[E0502]: cannot borrow value as mutable because it is also borrowed as immu
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:46:9 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:46:9
| |
LL | let ref mut a @ ref b = u(); LL | let ref mut a @ ref b = u();
| ^^^^^^^^^^^^----- | ^^^^^^^^^ ----- immutable borrow occurs here
| | | | |
| | immutable borrow occurs here
| mutable borrow occurs here | mutable borrow occurs here
... ...
LL | drop(b); LL | drop(b);
@ -322,9 +320,8 @@ error[E0502]: cannot borrow value as immutable because it is also borrowed as mu
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:51:9 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:51:9
| |
LL | let ref a @ ref mut b = u(); LL | let ref a @ ref mut b = u();
| ^^^^^^^^--------- | ^^^^^ --------- mutable borrow occurs here
| | | | |
| | mutable borrow occurs here
| immutable borrow occurs here | immutable borrow occurs here
... ...
LL | *b = u(); LL | *b = u();
@ -334,9 +331,8 @@ error[E0502]: cannot borrow value as mutable because it is also borrowed as immu
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:20 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:20
| |
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
| -----------^^^^^^^^^- | ----- ^^^^^^^^^ mutable borrow occurs here
| | | | |
| | mutable borrow occurs here
| immutable borrow occurs here | immutable borrow occurs here
... ...
LL | drop(a); LL | drop(a);
@ -346,9 +342,8 @@ error[E0502]: cannot borrow value as mutable because it is also borrowed as immu
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:45 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:76:45
| |
LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
| ------------^^^^^^^^^- | ----- ^^^^^^^^^ mutable borrow occurs here
| | | | |
| | mutable borrow occurs here
| immutable borrow occurs here | immutable borrow occurs here
... ...
LL | drop(a); LL | drop(a);
@ -406,9 +401,8 @@ error[E0502]: cannot borrow value as immutable because it is also borrowed as mu
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:117:9 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:117:9
| |
LL | let ref a @ (ref mut b, ref mut c) = (U, U); LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| ^^^^^^^^^---------^^^^^^^^^^^^ | ^^^^^ --------- mutable borrow occurs here
| | | | |
| | mutable borrow occurs here
| immutable borrow occurs here | immutable borrow occurs here
... ...
LL | *b = U; LL | *b = U;
@ -418,9 +412,8 @@ error[E0502]: cannot borrow value as immutable because it is also borrowed as mu
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:123:9 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:123:9
| |
LL | let ref a @ (ref mut b, ref mut c) = (U, U); LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| ^^^^^^^^^---------^^^^^^^^^^^^ | ^^^^^ --------- mutable borrow occurs here
| | | | |
| | mutable borrow occurs here
| immutable borrow occurs here | immutable borrow occurs here
... ...
LL | *b = U; LL | *b = U;
@ -430,9 +423,8 @@ error[E0502]: cannot borrow value as immutable because it is also borrowed as mu
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:129:9 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:129:9
| |
LL | let ref a @ (ref mut b, ref mut c) = (U, U); LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| ^^^^^^^^^---------^^^^^^^^^^^^ | ^^^^^ --------- mutable borrow occurs here
| | | | |
| | mutable borrow occurs here
| immutable borrow occurs here | immutable borrow occurs here
LL | LL |
LL | *b = U; LL | *b = U;
@ -442,7 +434,7 @@ error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:30 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:30
| |
LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {} LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {}
| --------^^^^^^^^^^^^- | --------^^^^^^^^^----
| | | | | | | |
| | | value moved here | | | value moved here
| | value borrowed here after move | | value borrowed here after move

View file

@ -262,9 +262,8 @@ error[E0499]: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:29:9 --> $DIR/borrowck-pat-ref-mut-twice.rs:29:9
| |
LL | let ref mut a @ ref mut b = U; LL | let ref mut a @ ref mut b = U;
| ^^^^^^^^^^^^--------- | ^^^^^^^^^ --------- first mutable borrow occurs here
| | | | |
| | first mutable borrow occurs here
| second mutable borrow occurs here | second mutable borrow occurs here
... ...
LL | drop(b); LL | drop(b);
@ -274,9 +273,8 @@ error[E0499]: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:39:9 --> $DIR/borrowck-pat-ref-mut-twice.rs:39:9
| |
LL | let ref mut a @ ref mut b = U; LL | let ref mut a @ ref mut b = U;
| ^^^^^^^^^^^^--------- | ^^^^^^^^^ --------- first mutable borrow occurs here
| | | | |
| | first mutable borrow occurs here
| second mutable borrow occurs here | second mutable borrow occurs here
... ...
LL | *b = U; LL | *b = U;
@ -286,9 +284,8 @@ error[E0499]: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:89:24 --> $DIR/borrowck-pat-ref-mut-twice.rs:89:24
| |
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------------^^^^^^^^^- | --------- ^^^^^^^^^ second mutable borrow occurs here
| | | | |
| | second mutable borrow occurs here
| first mutable borrow occurs here | first mutable borrow occurs here
... ...
LL | *a = Err(U); LL | *a = Err(U);
@ -298,9 +295,8 @@ error[E0499]: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:89:53 --> $DIR/borrowck-pat-ref-mut-twice.rs:89:53
| |
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ----------------^^^^^^^^^- | --------- ^^^^^^^^^ second mutable borrow occurs here
| | | | |
| | second mutable borrow occurs here
| first mutable borrow occurs here | first mutable borrow occurs here
... ...
LL | *a = Err(U); LL | *a = Err(U);
@ -310,9 +306,8 @@ error[E0499]: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:101:24 --> $DIR/borrowck-pat-ref-mut-twice.rs:101:24
| |
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ---------------^^^^^^^^^- | --------- ^^^^^^^^^ second mutable borrow occurs here
| | | | |
| | second mutable borrow occurs here
| first mutable borrow occurs here | first mutable borrow occurs here
... ...
LL | drop(a); LL | drop(a);
@ -322,9 +317,8 @@ error[E0499]: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:101:53 --> $DIR/borrowck-pat-ref-mut-twice.rs:101:53
| |
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => { LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ----------------^^^^^^^^^- | --------- ^^^^^^^^^ second mutable borrow occurs here
| | | | |
| | second mutable borrow occurs here
| first mutable borrow occurs here | first mutable borrow occurs here
... ...
LL | drop(a); LL | drop(a);
@ -334,7 +328,7 @@ error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-ref-mut-twice.rs:21:34 --> $DIR/borrowck-pat-ref-mut-twice.rs:21:34
| |
LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {} LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {}
| ------------^^^^^^^^^^^^- | ------------^^^^^^^^^----
| | | | | | | |
| | | value moved here | | | value moved here
| | value borrowed here after move | | value borrowed here after move

View file

@ -2,9 +2,8 @@ error[E0382]: use of partially moved value
--> $DIR/copy-and-move-mixed.rs:12:9 --> $DIR/copy-and-move-mixed.rs:12:9
| |
LL | let a @ NC(b, c @ NC(d, e)) = NC(C, NC(C, C)); LL | let a @ NC(b, c @ NC(d, e)) = NC(C, NC(C, C));
| ^^^^^^^^^^------------^ | ^ - value partially moved here
| | | | |
| | value partially moved here
| value used here after partial move | value used here after partial move
| |
= note: partial move occurs because value has type `NC<C, C>`, which does not implement the `Copy` trait = note: partial move occurs because value has type `NC<C, C>`, which does not implement the `Copy` trait

View file

@ -48,7 +48,7 @@ error[E0382]: borrow of moved value
--> $DIR/default-binding-modes-both-sides-independent.rs:29:9 --> $DIR/default-binding-modes-both-sides-independent.rs:29:9
| |
LL | let ref mut a @ b = NotCopy; LL | let ref mut a @ b = NotCopy;
| ^^^^^^^^^^^^- ------- move occurs because value has type `NotCopy`, which does not implement the `Copy` trait | ^^^^^^^^^ - ------- move occurs because value has type `NotCopy`, which does not implement the `Copy` trait
| | | | | |
| | value moved here | | value moved here
| value borrowed here after move | value borrowed here after move

View file

@ -11,7 +11,7 @@ error[E0596]: cannot borrow `not_mut` as mutable, as it is not declared as mutab
--> $DIR/nested-binding-modes-mut.rs:9:5 --> $DIR/nested-binding-modes-mut.rs:9:5
| |
LL | let not_mut @ mut is_mut = 42; LL | let not_mut @ mut is_mut = 42;
| -------------------- help: consider changing this to be mutable: `mut not_mut` | ------- help: consider changing this to be mutable: `mut not_mut`
LL | &mut is_mut; LL | &mut is_mut;
LL | &mut not_mut; LL | &mut not_mut;
| ^^^^^^^^^^^^ cannot borrow as mutable | ^^^^^^^^^^^^ cannot borrow as mutable

View file

@ -35,7 +35,7 @@ error[E0502]: cannot borrow `arr[..]` as mutable because it is also borrowed as
--> $DIR/borrowck-move-ref-pattern.rs:13:16 --> $DIR/borrowck-move-ref-pattern.rs:13:16
| |
LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr; LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr;
| ---------------- immutable borrow occurs here | ----------- immutable borrow occurs here
... ...
LL | let [_, _, ref mut _x2, _x3, mut _x4] = arr; LL | let [_, _, ref mut _x2, _x3, mut _x4] = arr;
| ^^^^^^^^^^^ mutable borrow occurs here | ^^^^^^^^^^^ mutable borrow occurs here
@ -47,7 +47,7 @@ error[E0505]: cannot move out of `arr[..]` because it is borrowed
--> $DIR/borrowck-move-ref-pattern.rs:13:29 --> $DIR/borrowck-move-ref-pattern.rs:13:29
| |
LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr; LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr;
| ---------------- borrow of `arr[..]` occurs here | ----------- borrow of `arr[..]` occurs here
... ...
LL | let [_, _, ref mut _x2, _x3, mut _x4] = arr; LL | let [_, _, ref mut _x2, _x3, mut _x4] = arr;
| ^^^ move out of `arr[..]` occurs here | ^^^ move out of `arr[..]` occurs here
@ -59,7 +59,7 @@ error[E0505]: cannot move out of `arr[..]` because it is borrowed
--> $DIR/borrowck-move-ref-pattern.rs:13:34 --> $DIR/borrowck-move-ref-pattern.rs:13:34
| |
LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr; LL | let [ref _x0_hold, _x1, ref xs_hold @ ..] = arr;
| ---------------- borrow of `arr[..]` occurs here | ----------- borrow of `arr[..]` occurs here
... ...
LL | let [_, _, ref mut _x2, _x3, mut _x4] = arr; LL | let [_, _, ref mut _x2, _x3, mut _x4] = arr;
| ^^^^^^^ move out of `arr[..]` occurs here | ^^^^^^^ move out of `arr[..]` occurs here