2018-08-08 14:28:26 +02:00
|
|
|
error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/borrowck-borrow-from-stack-variable.rs:18:22
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
|
LL | let bar1 = &mut foo.bar1;
|
|
|
|
| -------- first mutable borrow occurs here
|
|
|
|
LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow
|
|
|
|
| ^^^^^^^^ 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 08:56:47 -07:00
|
|
|
--> $DIR/borrowck-borrow-from-stack-variable.rs:25:18
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
|
LL | let bar1 = &mut foo.bar1;
|
|
|
|
| -------- mutable borrow occurs here
|
|
|
|
LL | let _bar2 = &foo.bar1; //~ ERROR cannot borrow
|
|
|
|
| ^^^^^^^^ 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 08:56:47 -07:00
|
|
|
--> $DIR/borrowck-borrow-from-stack-variable.rs:32:22
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
|
LL | let bar1 = &foo.bar1;
|
|
|
|
| -------- immutable borrow occurs here
|
|
|
|
LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow
|
|
|
|
| ^^^^^^^^ mutable borrow occurs here
|
|
|
|
LL | *bar1;
|
|
|
|
LL | }
|
|
|
|
| - immutable borrow ends here
|
|
|
|
|
|
|
|
error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/borrowck-borrow-from-stack-variable.rs:61:21
|
2018-08-08 14:28:26 +02: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 08:56:47 -07:00
|
|
|
--> $DIR/borrowck-borrow-from-stack-variable.rs:70:18
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
|
LL | let bar1 = &mut foo.bar1.int1;
|
|
|
|
| ------------- mutable borrow occurs here
|
|
|
|
LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow
|
|
|
|
| ^^^^^^^^ 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 08:56:47 -07:00
|
|
|
--> $DIR/borrowck-borrow-from-stack-variable.rs:71:18
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
|
LL | let bar1 = &mut foo.bar1.int1;
|
|
|
|
| ------------- mutable borrow occurs here
|
|
|
|
LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow
|
|
|
|
LL | let _foo2 = &foo; //~ ERROR cannot borrow
|
|
|
|
| ^^^ 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 08:56:47 -07:00
|
|
|
--> $DIR/borrowck-borrow-from-stack-variable.rs:78:22
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
|
LL | let bar1 = &mut foo.bar1.int1;
|
|
|
|
| ------------- first mutable borrow occurs here
|
|
|
|
LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
|
|
|
|
| ^^^^^^^^ 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 08:56:47 -07:00
|
|
|
--> $DIR/borrowck-borrow-from-stack-variable.rs:85:22
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
|
LL | let bar1 = &mut foo.bar1.int1;
|
|
|
|
| ------------- first mutable borrow occurs here
|
|
|
|
LL | let _foo2 = &mut foo; //~ ERROR cannot borrow
|
|
|
|
| ^^^ 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 08:56:47 -07:00
|
|
|
--> $DIR/borrowck-borrow-from-stack-variable.rs:92:22
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
|
LL | let bar1 = &foo.bar1.int1;
|
|
|
|
| ------------- immutable borrow occurs here
|
|
|
|
LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
|
|
|
|
| ^^^^^^^^ 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 08:56:47 -07:00
|
|
|
--> $DIR/borrowck-borrow-from-stack-variable.rs:99:22
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
|
LL | let bar1 = &foo.bar1.int1;
|
|
|
|
| ------------- immutable borrow occurs here
|
|
|
|
LL | let _foo2 = &mut foo; //~ ERROR cannot borrow
|
|
|
|
| ^^^ mutable borrow occurs here
|
|
|
|
LL | *bar1;
|
|
|
|
LL | }
|
|
|
|
| - immutable borrow ends here
|
|
|
|
|
|
|
|
error[E0596]: cannot borrow field `foo.bar1` of immutable binding as mutable
|
2018-12-25 08:56:47 -07:00
|
|
|
--> $DIR/borrowck-borrow-from-stack-variable.rs:120:21
|
2018-08-08 14:28:26 +02:00
|
|
|
|
|
|
|
|
LL | let foo = make_foo();
|
2018-09-12 14:13:40 -04:00
|
|
|
| --- help: make this binding mutable: `mut foo`
|
2018-08-08 14:28:26 +02:00
|
|
|
LL | let bar1 = &mut foo.bar1; //~ ERROR cannot borrow
|
|
|
|
| ^^^^^^^^ cannot mutably borrow field of immutable binding
|
|
|
|
|
|
|
|
error: aborting due to 11 previous errors
|
|
|
|
|
|
|
|
Some errors occurred: E0499, E0502, E0596.
|
|
|
|
For more information about an error, try `rustc --explain E0499`.
|