rust/src/test/ui/borrowck/borrow-tuple-fields.stderr

65 lines
1.9 KiB
Plaintext
Raw Normal View History

2018-08-08 14:28:26 +02:00
error[E0505]: cannot move out of `x` because it is borrowed
2018-12-25 08:56:47 -07:00
--> $DIR/borrow-tuple-fields.rs:12:9
2018-08-08 14:28:26 +02:00
|
LL | let r = &x.0;
| --- borrow of `x.0` occurs here
2019-03-09 15:03:44 +03:00
LL | let y = x;
2018-08-08 14:28:26 +02:00
| ^ move out of `x` occurs here
error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
2018-12-25 08:56:47 -07:00
--> $DIR/borrow-tuple-fields.rs:18:18
2018-08-08 14:28:26 +02:00
|
LL | let a = &x.0;
| --- immutable borrow occurs here
2019-03-09 15:03:44 +03:00
LL | let b = &mut x.0;
2018-08-08 14:28:26 +02:00
| ^^^ mutable borrow occurs here
...
LL | }
| - immutable borrow ends here
error[E0499]: cannot borrow `x.0` as mutable more than once at a time
2018-12-25 08:56:47 -07:00
--> $DIR/borrow-tuple-fields.rs:23:18
2018-08-08 14:28:26 +02:00
|
LL | let a = &mut x.0;
| --- first mutable borrow occurs here
2019-03-09 15:03:44 +03:00
LL | let b = &mut x.0;
2018-08-08 14:28:26 +02:00
| ^^^ second mutable borrow occurs here
...
LL | }
| - first borrow ends here
error[E0505]: cannot move out of `x` because it is borrowed
2018-12-25 08:56:47 -07:00
--> $DIR/borrow-tuple-fields.rs:28:9
2018-08-08 14:28:26 +02:00
|
LL | let r = &x.0;
| --- borrow of `x.0` occurs here
2019-03-09 15:03:44 +03:00
LL | let y = x;
2018-08-08 14:28:26 +02:00
| ^ move out of `x` occurs here
error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
2018-12-25 08:56:47 -07:00
--> $DIR/borrow-tuple-fields.rs:33:18
2018-08-08 14:28:26 +02:00
|
LL | let a = &x.0;
| --- immutable borrow occurs here
2019-03-09 15:03:44 +03:00
LL | let b = &mut x.0;
2018-08-08 14:28:26 +02:00
| ^^^ mutable borrow occurs here
...
LL | }
| - immutable borrow ends here
error[E0499]: cannot borrow `x.0` as mutable more than once at a time
2018-12-25 08:56:47 -07:00
--> $DIR/borrow-tuple-fields.rs:38:18
2018-08-08 14:28:26 +02:00
|
LL | let a = &mut x.0;
| --- first mutable borrow occurs here
2019-03-09 15:03:44 +03:00
LL | let b = &mut x.0;
2018-08-08 14:28:26 +02:00
| ^^^ second mutable borrow occurs here
LL | a.use_mut();
2018-08-08 14:28:26 +02:00
LL | }
| - first borrow ends here
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0499, E0502, E0505.
2018-08-08 14:28:26 +02:00
For more information about an error, try `rustc --explain E0499`.