rust/tests/ui/borrowck/borrowck-use-mut-borrow.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

96 lines
2.8 KiB
Plaintext
Raw Normal View History

2018-08-08 12:28:26 +00:00
error[E0503]: cannot use `x` because it was mutably borrowed
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-use-mut-borrow.rs:11:10
2018-08-08 12:28:26 +00:00
|
LL | let p = &mut x;
2023-01-15 03:06:44 +00:00
| ------ `x` is borrowed here
2019-03-09 12:03:44 +00:00
LL | drop(x);
2018-08-08 12:28:26 +00:00
| ^ use of borrowed `x`
LL | *p = 2;
| ------ borrow later used here
2018-08-08 12:28:26 +00:00
error[E0503]: cannot use `x` because it was mutably borrowed
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-use-mut-borrow.rs:18:10
2018-08-08 12:28:26 +00:00
|
LL | let p = &mut x.a;
2023-01-15 03:06:44 +00:00
| -------- `x.a` is borrowed here
2019-03-09 12:03:44 +00:00
LL | drop(x);
2018-08-08 12:28:26 +00:00
| ^ use of borrowed `x.a`
LL | *p = 3;
| ------ borrow later used here
2018-08-08 12:28:26 +00:00
error[E0503]: cannot use `x.a` because it was mutably borrowed
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-use-mut-borrow.rs:25:10
2018-08-08 12:28:26 +00:00
|
LL | let p = &mut x;
2023-01-15 03:06:44 +00:00
| ------ `x` is borrowed here
2019-03-09 12:03:44 +00:00
LL | drop(x.a);
2018-08-08 12:28:26 +00:00
| ^^^ use of borrowed `x`
LL | p.a = 3;
| ------- borrow later used here
2018-08-08 12:28:26 +00:00
error[E0503]: cannot use `x.a` because it was mutably borrowed
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-use-mut-borrow.rs:32:10
2018-08-08 12:28:26 +00:00
|
LL | let p = &mut x.a;
2023-01-15 03:06:44 +00:00
| -------- `x.a` is borrowed here
2019-03-09 12:03:44 +00:00
LL | drop(x.a);
2018-08-08 12:28:26 +00:00
| ^^^ use of borrowed `x.a`
LL | *p = 3;
| ------ borrow later used here
2018-08-08 12:28:26 +00:00
error[E0503]: cannot use `x.a` because it was mutably borrowed
--> $DIR/borrowck-use-mut-borrow.rs:39:13
2018-08-08 12:28:26 +00:00
|
LL | let p = &mut x;
2023-01-15 03:06:44 +00:00
| ------ `x` is borrowed here
2019-03-09 12:03:44 +00:00
LL | let y = A { b: 3, .. x };
| ^^^^^^^^^^^^^^^^ use of borrowed `x`
LL | drop(y);
LL | p.a = 4;
| ------- borrow later used here
2018-08-08 12:28:26 +00:00
error[E0503]: cannot use `x.a` because it was mutably borrowed
--> $DIR/borrowck-use-mut-borrow.rs:47:13
2018-08-08 12:28:26 +00:00
|
LL | let p = &mut x.a;
2023-01-15 03:06:44 +00:00
| -------- `x.a` is borrowed here
2019-03-09 12:03:44 +00:00
LL | let y = A { b: 3, .. x };
| ^^^^^^^^^^^^^^^^ use of borrowed `x.a`
LL | drop(y);
LL | *p = 4;
| ------ borrow later used here
2018-08-08 12:28:26 +00:00
error[E0503]: cannot use `*x` because it was mutably borrowed
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-use-mut-borrow.rs:55:10
2018-08-08 12:28:26 +00:00
|
LL | let p = &mut x;
2023-01-15 03:06:44 +00:00
| ------ `x` is borrowed here
2019-03-09 12:03:44 +00:00
LL | drop(*x);
2018-08-08 12:28:26 +00:00
| ^^ use of borrowed `x`
LL | **p = 2;
| ------- borrow later used here
2018-08-08 12:28:26 +00:00
error[E0503]: cannot use `*x.b` because it was mutably borrowed
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-use-mut-borrow.rs:62:10
2018-08-08 12:28:26 +00:00
|
LL | let p = &mut x;
2023-01-15 03:06:44 +00:00
| ------ `x` is borrowed here
2019-03-09 12:03:44 +00:00
LL | drop(*x.b);
2018-08-08 12:28:26 +00:00
| ^^^^ use of borrowed `x`
LL | p.a = 3;
| ------- borrow later used here
2018-08-08 12:28:26 +00:00
error[E0503]: cannot use `*x.b` because it was mutably borrowed
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-use-mut-borrow.rs:69:10
2018-08-08 12:28:26 +00:00
|
LL | let p = &mut x.b;
2023-01-15 03:06:44 +00:00
| -------- `x.b` is borrowed here
2019-03-09 12:03:44 +00:00
LL | drop(*x.b);
2018-08-08 12:28:26 +00:00
| ^^^^ use of borrowed `x.b`
LL | **p = 3;
| ------- borrow later used here
2018-08-08 12:28:26 +00:00
error: aborting due to 9 previous errors
For more information about this error, try `rustc --explain E0503`.