2018-08-08 07:28:26 -05:00
|
|
|
error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
|
2019-04-22 02:40:08 -05:00
|
|
|
--> $DIR/borrowck-borrow-from-owned-ptr.rs:18:17
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let bar1 = &mut foo.bar1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ------------- first mutable borrow occurs here
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let _bar2 = &mut foo.bar1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ^^^^^^^^^^^^^ second mutable borrow occurs here
|
2018-08-08 07:28:26 -05:00
|
|
|
LL | *bar1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ----- first borrow later used here
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
|
2019-04-22 02:40:08 -05:00
|
|
|
--> $DIR/borrowck-borrow-from-owned-ptr.rs:25:17
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let bar1 = &mut foo.bar1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ------------- mutable borrow occurs here
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let _bar2 = &foo.bar1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ^^^^^^^^^ immutable borrow occurs here
|
2018-08-08 07:28:26 -05:00
|
|
|
LL | *bar1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ----- mutable borrow later used here
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
|
2019-04-22 02:40:08 -05:00
|
|
|
--> $DIR/borrowck-borrow-from-owned-ptr.rs:32:17
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let bar1 = &foo.bar1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| --------- immutable borrow occurs here
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let _bar2 = &mut foo.bar1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ^^^^^^^^^^^^^ mutable borrow occurs here
|
2018-08-08 07:28:26 -05:00
|
|
|
LL | *bar1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ----- immutable borrow later used here
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
|
2019-04-22 02:40:08 -05:00
|
|
|
--> $DIR/borrowck-borrow-from-owned-ptr.rs:64:21
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let bar1 = &mut foo.bar1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ------------- first mutable borrow occurs here
|
2018-08-08 07:28:26 -05:00
|
|
|
LL | match *foo {
|
|
|
|
LL | Foo { bar1: ref mut _bar1, bar2: _ } => {}
|
|
|
|
| ^^^^^^^^^^^^^ second mutable borrow occurs here
|
|
|
|
...
|
2019-04-22 02:40:08 -05:00
|
|
|
LL | *bar1;
|
|
|
|
| ----- first borrow later used here
|
2018-08-08 07:28:26 -05:00
|
|
|
|
2019-04-22 02:40:08 -05:00
|
|
|
error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
|
|
|
|
--> $DIR/borrowck-borrow-from-owned-ptr.rs:73:17
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let bar1 = &mut foo.bar1.int1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ------------------ mutable borrow occurs here
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let _foo1 = &foo.bar1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ^^^^^^^^^ immutable borrow occurs here
|
|
|
|
LL | let _foo2 = &*foo;
|
|
|
|
LL | *bar1;
|
|
|
|
| ----- mutable borrow later used here
|
2018-08-08 07:28:26 -05:00
|
|
|
|
2019-04-22 02:40:08 -05:00
|
|
|
error[E0502]: cannot borrow `*foo` as immutable because it is also borrowed as mutable
|
|
|
|
--> $DIR/borrowck-borrow-from-owned-ptr.rs:74:17
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let bar1 = &mut foo.bar1.int1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ------------------ mutable borrow occurs here
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let _foo1 = &foo.bar1;
|
|
|
|
LL | let _foo2 = &*foo;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ^^^^^ immutable borrow occurs here
|
2018-08-08 07:28:26 -05:00
|
|
|
LL | *bar1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ----- mutable borrow later used here
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
|
2019-04-22 02:40:08 -05:00
|
|
|
--> $DIR/borrowck-borrow-from-owned-ptr.rs:81:17
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let bar1 = &mut foo.bar1.int1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ------------------ first mutable borrow occurs here
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let _foo1 = &mut foo.bar1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ^^^^^^^^^^^^^ second mutable borrow occurs here
|
2018-08-08 07:28:26 -05:00
|
|
|
LL | *bar1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ----- first borrow later used here
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
error[E0499]: cannot borrow `*foo` as mutable more than once at a time
|
2019-04-22 02:40:08 -05:00
|
|
|
--> $DIR/borrowck-borrow-from-owned-ptr.rs:88:17
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let bar1 = &mut foo.bar1.int1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ------------------ first mutable borrow occurs here
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let _foo2 = &mut *foo;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ^^^^^^^^^ second mutable borrow occurs here
|
2018-08-08 07:28:26 -05:00
|
|
|
LL | *bar1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ----- first borrow later used here
|
2018-08-08 07:28:26 -05:00
|
|
|
|
2019-04-22 02:40:08 -05:00
|
|
|
error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
|
|
|
|
--> $DIR/borrowck-borrow-from-owned-ptr.rs:95:17
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let bar1 = &foo.bar1.int1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| -------------- immutable borrow occurs here
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let _foo1 = &mut foo.bar1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ^^^^^^^^^^^^^ mutable borrow occurs here
|
2018-08-08 07:28:26 -05:00
|
|
|
LL | *bar1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ----- immutable borrow later used here
|
2018-08-08 07:28:26 -05:00
|
|
|
|
2019-04-22 02:40:08 -05:00
|
|
|
error[E0502]: cannot borrow `*foo` as mutable because it is also borrowed as immutable
|
|
|
|
--> $DIR/borrowck-borrow-from-owned-ptr.rs:102:17
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let bar1 = &foo.bar1.int1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| -------------- immutable borrow occurs here
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let _foo2 = &mut *foo;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ^^^^^^^^^ mutable borrow occurs here
|
2018-08-08 07:28:26 -05:00
|
|
|
LL | *bar1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ----- immutable borrow later used here
|
2018-08-08 07:28:26 -05:00
|
|
|
|
2019-04-22 02:40:08 -05:00
|
|
|
error[E0596]: cannot borrow `foo.bar1` as mutable, as `foo` is not declared as mutable
|
|
|
|
--> $DIR/borrowck-borrow-from-owned-ptr.rs:122:16
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let bar1 = &mut foo.bar1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ^^^^^^^^^^^^^ cannot borrow as mutable
|
2023-01-01 02:06:31 -06:00
|
|
|
|
|
|
|
|
help: consider changing this to be mutable
|
|
|
|
|
|
|
|
|
LL | let mut foo = make_foo();
|
|
|
|
| +++
|
2018-08-08 07:28:26 -05:00
|
|
|
|
2019-04-22 02:40:08 -05:00
|
|
|
error: aborting due to 11 previous errors
|
2018-08-08 07:28:26 -05:00
|
|
|
|
2019-04-17 12:26:38 -05:00
|
|
|
Some errors have detailed explanations: E0499, E0502, E0596.
|
2018-08-08 07:28:26 -05:00
|
|
|
For more information about an error, try `rustc --explain E0499`.
|