rust/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr

169 lines
6.3 KiB
Plaintext
Raw Normal View History

2018-08-08 12:28:26 +00:00
error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-borrow-from-owned-ptr.rs:18:22
2018-08-08 12:28:26 +00:00
|
LL | let bar1 = &mut foo.bar1;
| -------- first mutable borrow occurs here
2019-03-09 12:03:44 +00:00
LL | let _bar2 = &mut foo.bar1;
2018-08-08 12:28:26 +00:00
| ^^^^^^^^ second mutable borrow occurs here
LL | *bar1;
LL | }
| - first borrow ends here
error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-borrow-from-owned-ptr.rs:25:18
2018-08-08 12:28:26 +00:00
|
LL | let bar1 = &mut foo.bar1;
| -------- mutable borrow occurs here
2019-03-09 12:03:44 +00:00
LL | let _bar2 = &foo.bar1;
2018-08-08 12:28:26 +00:00
| ^^^^^^^^ immutable borrow occurs here
LL | *bar1;
LL | }
| - mutable borrow ends here
error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-borrow-from-owned-ptr.rs:32:22
2018-08-08 12:28:26 +00:00
|
LL | let bar1 = &foo.bar1;
| -------- immutable borrow occurs here
2019-03-09 12:03:44 +00:00
LL | let _bar2 = &mut foo.bar1;
2018-08-08 12:28:26 +00:00
| ^^^^^^^^ mutable borrow occurs here
LL | *bar1;
LL | }
| - immutable borrow ends here
error[E0499]: cannot borrow `foo` (via `foo.bar2`) as mutable more than once at a time
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-borrow-from-owned-ptr.rs:46:22
2018-08-08 12:28:26 +00:00
|
LL | let bar1 = &mut foo.bar1;
| -------- first mutable borrow occurs here (via `foo.bar1`)
2019-03-09 12:03:44 +00:00
LL | let _bar2 = &mut foo.bar2;
2018-08-08 12:28:26 +00:00
| ^^^^^^^^ second mutable borrow occurs here (via `foo.bar2`)
LL | *bar1;
LL | }
| - first borrow ends here
error[E0499]: cannot borrow `foo` (via `foo.bar2`) as mutable more than once at a time
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-borrow-from-owned-ptr.rs:53:42
2018-08-08 12:28:26 +00:00
|
LL | Foo { bar1: ref mut _bar1, bar2: ref mut _bar2 } => {}
| ------------- ^^^^^^^^^^^^^ second mutable borrow occurs here (via `foo.bar2`)
| |
| first mutable borrow occurs here (via `foo.bar1`)
2019-03-09 12:03:44 +00:00
LL |
2018-08-08 12:28:26 +00:00
LL | }
| - first borrow ends here
error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-borrow-from-owned-ptr.rs:62:21
2018-08-08 12:28:26 +00:00
|
LL | let bar1 = &mut foo.bar1;
| -------- first mutable borrow occurs here
LL | match *foo {
LL | Foo { bar1: ref mut _bar1, bar2: _ } => {}
| ^^^^^^^^^^^^^ second mutable borrow occurs here
...
LL | }
| - first borrow ends here
error[E0502]: cannot borrow `foo.bar1` as immutable because `foo.bar1.int1` is also borrowed as mutable
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-borrow-from-owned-ptr.rs:71:18
2018-08-08 12:28:26 +00:00
|
LL | let bar1 = &mut foo.bar1.int1;
| ------------- mutable borrow occurs here
2019-03-09 12:03:44 +00:00
LL | let _foo1 = &foo.bar1;
2018-08-08 12:28:26 +00:00
| ^^^^^^^^ immutable borrow occurs here
...
LL | }
| - mutable borrow ends here
error[E0502]: cannot borrow `*foo` as immutable because `foo.bar1.int1` is also borrowed as mutable
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-borrow-from-owned-ptr.rs:72:18
2018-08-08 12:28:26 +00:00
|
LL | let bar1 = &mut foo.bar1.int1;
| ------------- mutable borrow occurs here
2019-03-09 12:03:44 +00:00
LL | let _foo1 = &foo.bar1;
LL | let _foo2 = &*foo;
2018-08-08 12:28:26 +00:00
| ^^^^ immutable borrow occurs here
LL | *bar1;
LL | }
| - mutable borrow ends here
error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-borrow-from-owned-ptr.rs:79:22
2018-08-08 12:28:26 +00:00
|
LL | let bar1 = &mut foo.bar1.int1;
| ------------- first mutable borrow occurs here
2019-03-09 12:03:44 +00:00
LL | let _foo1 = &mut foo.bar1;
2018-08-08 12:28:26 +00:00
| ^^^^^^^^ second mutable borrow occurs here
LL | *bar1;
LL | }
| - first borrow ends here
error[E0499]: cannot borrow `*foo` as mutable more than once at a time
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-borrow-from-owned-ptr.rs:86:22
2018-08-08 12:28:26 +00:00
|
LL | let bar1 = &mut foo.bar1.int1;
| ------------- first mutable borrow occurs here
2019-03-09 12:03:44 +00:00
LL | let _foo2 = &mut *foo;
2018-08-08 12:28:26 +00:00
| ^^^^ second mutable borrow occurs here
LL | *bar1;
LL | }
| - first borrow ends here
error[E0502]: cannot borrow `foo.bar1` as mutable because `foo.bar1.int1` is also borrowed as immutable
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-borrow-from-owned-ptr.rs:93:22
2018-08-08 12:28:26 +00:00
|
LL | let bar1 = &foo.bar1.int1;
| ------------- immutable borrow occurs here
2019-03-09 12:03:44 +00:00
LL | let _foo1 = &mut foo.bar1;
2018-08-08 12:28:26 +00:00
| ^^^^^^^^ mutable borrow occurs here
LL | *bar1;
LL | }
| - immutable borrow ends here
error[E0502]: cannot borrow `*foo` as mutable because `foo.bar1.int1` is also borrowed as immutable
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-borrow-from-owned-ptr.rs:100:22
2018-08-08 12:28:26 +00:00
|
LL | let bar1 = &foo.bar1.int1;
| ------------- immutable borrow occurs here
2019-03-09 12:03:44 +00:00
LL | let _foo2 = &mut *foo;
2018-08-08 12:28:26 +00:00
| ^^^^ mutable borrow occurs here
LL | *bar1;
LL | }
| - immutable borrow ends here
error[E0502]: cannot borrow `foo` (via `foo.bar2`) as immutable because `foo` is also borrowed as mutable (via `foo.bar1`)
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-borrow-from-owned-ptr.rs:115:18
2018-08-08 12:28:26 +00:00
|
LL | let bar1 = &mut foo.bar1;
| -------- mutable borrow occurs here (via `foo.bar1`)
2019-03-09 12:03:44 +00:00
LL | let _foo1 = &foo.bar2;
| ^^^^^^^^ immutable borrow of `foo.bar2` -- which overlaps with `foo.bar1` -- occurs here
2018-08-08 12:28:26 +00:00
LL | *bar1;
LL | }
| - mutable borrow ends here
error[E0596]: cannot borrow field `foo.bar1` of immutable binding as mutable
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-borrow-from-owned-ptr.rs:121:21
2018-08-08 12:28:26 +00:00
|
LL | let foo = make_foo();
| --- help: make this binding mutable: `mut foo`
2019-03-09 12:03:44 +00:00
LL | let bar1 = &mut foo.bar1;
2018-08-08 12:28:26 +00:00
| ^^^^^^^^ cannot mutably borrow field of immutable binding
error[E0499]: cannot borrow `foo` (via `foo.bar2.int2`) as mutable more than once at a time
2018-12-25 15:56:47 +00:00
--> $DIR/borrowck-borrow-from-owned-ptr.rs:128:21
2018-08-08 12:28:26 +00:00
|
LL | let bar1 = &mut foo.bar1.int1;
| ------------- first mutable borrow occurs here (via `foo.bar1.int1`)
2019-03-09 12:03:44 +00:00
LL | let foo1 = &mut foo.bar2.int2;
2018-08-08 12:28:26 +00:00
| ^^^^^^^^^^^^^ second mutable borrow occurs here (via `foo.bar2.int2`)
...
LL | }
| - first borrow ends here
error: aborting due to 15 previous errors
Some errors have detailed explanations: E0499, E0502, E0596.
2018-08-08 12:28:26 +00:00
For more information about an error, try `rustc --explain E0499`.