2020-03-07 22:01:11 -06:00
|
|
|
error: cannot borrow value as mutable because it is also borrowed as immutable
|
2020-11-21 16:05:17 -06:00
|
|
|
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:37:9
|
2020-03-07 22:01:11 -06:00
|
|
|
|
|
|
|
|
LL | ref foo @ [.., ref mut bar] => (),
|
|
|
|
| -------^^^^^^^^-----------^
|
|
|
|
| | |
|
|
|
|
| | mutable borrow, by `bar`, occurs here
|
|
|
|
| immutable borrow, by `foo`, occurs here
|
|
|
|
|
|
|
|
error: cannot borrow value as mutable because it is also borrowed as immutable
|
2020-11-21 16:05:17 -06:00
|
|
|
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:121:9
|
2020-03-07 22:01:11 -06:00
|
|
|
|
|
|
|
|
LL | ref foo @ Some(box ref mut s) => (),
|
|
|
|
| -------^^^^^^^^^^^^---------^
|
|
|
|
| | |
|
|
|
|
| | mutable borrow, by `s`, occurs here
|
|
|
|
| immutable borrow, by `foo`, occurs here
|
|
|
|
|
|
|
|
error[E0382]: borrow of moved value: `x`
|
2020-11-21 16:05:17 -06:00
|
|
|
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:19:5
|
2020-03-07 22:01:11 -06:00
|
|
|
|
|
|
|
|
LL | fn bindings_after_at_slice_patterns_move_binding(x: [String; 4]) {
|
2020-09-02 10:40:56 +03:00
|
|
|
| - move occurs because `x` has type `[String; 4]`, which does not implement the `Copy` trait
|
2020-03-07 22:01:11 -06:00
|
|
|
LL | match x {
|
|
|
|
LL | a @ [.., _] => (),
|
|
|
|
| ----------- value moved here
|
|
|
|
...
|
|
|
|
LL | &x;
|
|
|
|
| ^^ value borrowed here after move
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
|
2020-11-21 16:05:17 -06:00
|
|
|
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:29:5
|
2020-03-07 22:01:11 -06:00
|
|
|
|
|
|
|
|
LL | ref mut foo @ [.., _] => Some(foo),
|
|
|
|
| --------------------- mutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | &x;
|
|
|
|
| ^^ immutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | drop(r);
|
|
|
|
| - mutable borrow later used here
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
|
2020-11-21 16:05:17 -06:00
|
|
|
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:51:5
|
2020-03-07 22:01:11 -06:00
|
|
|
|
|
|
|
|
LL | [ref foo @ .., ref bar] => Some(foo),
|
|
|
|
| ------------ immutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | &mut x;
|
|
|
|
| ^^^^^^ mutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | drop(r);
|
|
|
|
| - immutable borrow later used here
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
|
2020-11-21 16:05:17 -06:00
|
|
|
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:63:5
|
2020-03-07 22:01:11 -06:00
|
|
|
|
|
|
|
|
LL | ref foo @ [.., ref bar] => Some(foo),
|
|
|
|
| ----------------------- immutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | &mut x;
|
|
|
|
| ^^^^^^ mutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | drop(r);
|
|
|
|
| - immutable borrow later used here
|
|
|
|
|
|
|
|
error[E0382]: borrow of moved value: `x`
|
2020-11-21 16:05:17 -06:00
|
|
|
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:77:5
|
2020-03-07 22:01:11 -06:00
|
|
|
|
|
|
|
|
LL | fn bindings_after_at_or_patterns_move(x: Option<Test>) {
|
2020-09-02 10:40:56 +03:00
|
|
|
| - move occurs because `x` has type `Option<Test>`, which does not implement the `Copy` trait
|
2020-03-07 22:01:11 -06:00
|
|
|
LL | match x {
|
|
|
|
LL | foo @ Some(Test::Foo | Test::Bar) => (),
|
|
|
|
| ---------------------------------
|
|
|
|
| |
|
|
|
|
| value moved here
|
|
|
|
| value moved here
|
|
|
|
...
|
|
|
|
LL | &x;
|
|
|
|
| ^^ value borrowed here after move
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
|
2020-11-21 16:05:17 -06:00
|
|
|
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:87:5
|
2020-03-07 22:01:11 -06:00
|
|
|
|
|
|
|
|
LL | ref foo @ Some(Test::Foo | Test::Bar) => Some(foo),
|
|
|
|
| ------------------------------------- immutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | &mut x;
|
|
|
|
| ^^^^^^ mutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | drop(r);
|
|
|
|
| - immutable borrow later used here
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
|
2020-11-21 16:05:17 -06:00
|
|
|
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:99:5
|
2020-03-07 22:01:11 -06:00
|
|
|
|
|
|
|
|
LL | ref mut foo @ Some(Test::Foo | Test::Bar) => Some(foo),
|
|
|
|
| ----------------------------------------- mutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | &x;
|
|
|
|
| ^^ immutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | drop(r);
|
|
|
|
| - mutable borrow later used here
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
|
2020-11-21 16:05:17 -06:00
|
|
|
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:113:5
|
2020-03-07 22:01:11 -06:00
|
|
|
|
|
|
|
|
LL | ref foo @ Some(box ref s) => Some(foo),
|
|
|
|
| ------------------------- immutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | &mut x;
|
|
|
|
| ^^^^^^ mutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | drop(r);
|
|
|
|
| - immutable borrow later used here
|
|
|
|
|
|
|
|
error[E0382]: borrow of moved value: `x`
|
2020-11-21 16:05:17 -06:00
|
|
|
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:135:5
|
2020-03-07 22:01:11 -06:00
|
|
|
|
|
|
|
|
LL | fn bindings_after_at_slice_patterns_or_patterns_moves(x: [Option<Test>; 4]) {
|
2020-09-02 10:40:56 +03:00
|
|
|
| - move occurs because `x` has type `[Option<Test>; 4]`, which does not implement the `Copy` trait
|
2020-03-07 22:01:11 -06:00
|
|
|
LL | match x {
|
|
|
|
LL | a @ [.., Some(Test::Foo | Test::Bar)] => (),
|
|
|
|
| -------------------------------------
|
|
|
|
| |
|
|
|
|
| value moved here
|
|
|
|
| value moved here
|
|
|
|
...
|
|
|
|
LL | &x;
|
|
|
|
| ^^ value borrowed here after move
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
|
2020-11-21 16:05:17 -06:00
|
|
|
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:145:5
|
2020-03-07 22:01:11 -06:00
|
|
|
|
|
|
|
|
LL | ref a @ [ref b @ .., Some(Test::Foo | Test::Bar)] => Some(a),
|
|
|
|
| ------------------------------------------------- immutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | &mut x;
|
|
|
|
| ^^^^^^ mutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | drop(r);
|
|
|
|
| - immutable borrow later used here
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
|
2020-11-21 16:05:17 -06:00
|
|
|
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:157:5
|
2020-03-07 22:01:11 -06:00
|
|
|
|
|
|
|
|
LL | ref a @ [ref b @ .., Some(Test::Foo | Test::Bar)] => Some(b),
|
|
|
|
| ---------- immutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | &mut x;
|
|
|
|
| ^^^^^^ mutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | drop(r);
|
|
|
|
| - immutable borrow later used here
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
|
2020-11-21 16:05:17 -06:00
|
|
|
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:171:5
|
2020-03-07 22:01:11 -06:00
|
|
|
|
|
|
|
|
LL | [_, ref a @ Some(box ref b), ..] => Some(a),
|
|
|
|
| ----------------------- immutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | &mut x;
|
|
|
|
| ^^^^^^ mutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | drop(r);
|
|
|
|
| - immutable borrow later used here
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
|
2020-11-21 16:05:17 -06:00
|
|
|
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:187:5
|
2020-03-07 22:01:11 -06:00
|
|
|
|
|
|
|
|
LL | [_, ref a @ Some(box Test::Foo | box Test::Bar), ..] => Some(a),
|
|
|
|
| ------------------------------------------- immutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | &mut x;
|
|
|
|
| ^^^^^^ mutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | drop(r);
|
|
|
|
| - immutable borrow later used here
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
|
2020-11-21 16:05:17 -06:00
|
|
|
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:201:5
|
2020-03-07 22:01:11 -06:00
|
|
|
|
|
|
|
|
LL | [_, ref mut a @ Some(box Test::Foo | box Test::Bar), ..] => Some(a),
|
|
|
|
| ----------------------------------------------- mutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | &x;
|
|
|
|
| ^^ immutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | drop(r);
|
|
|
|
| - mutable borrow later used here
|
|
|
|
|
|
|
|
error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
|
2020-11-21 16:05:17 -06:00
|
|
|
--> $DIR/bindings-after-at-or-patterns-slice-patterns-box-patterns.rs:215:5
|
2020-03-07 22:01:11 -06:00
|
|
|
|
|
|
|
|
LL | ref a @ [_, ref b @ Some(box Test::Foo | box Test::Bar), ..] => Some(a),
|
|
|
|
| ------------------------------------------------------------ immutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | &mut x;
|
|
|
|
| ^^^^^^ mutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | drop(r);
|
|
|
|
| - immutable borrow later used here
|
|
|
|
|
|
|
|
error: aborting due to 17 previous errors
|
|
|
|
|
|
|
|
Some errors have detailed explanations: E0382, E0502.
|
|
|
|
For more information about an error, try `rustc --explain E0382`.
|