122 lines
4.1 KiB
Plaintext
122 lines
4.1 KiB
Plaintext
error[E0596]: cannot borrow `foo` as mutable, as it is not declared as mutable
|
|
--> $DIR/borrow-mut-xor-share.rs:24:17
|
|
|
|
|
LL | foo_pin_mut(&pin mut foo);
|
|
| ^^^^^^^^^^^^ cannot borrow as mutable
|
|
|
|
|
help: consider changing this to be mutable
|
|
|
|
|
LL | let mut foo = Foo;
|
|
| +++
|
|
|
|
error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mutable
|
|
--> $DIR/borrow-mut-xor-share.rs:28:17
|
|
|
|
|
LL | let x = &pin mut foo;
|
|
| ------------ mutable borrow occurs here
|
|
LL | foo_pin_ref(&pin const foo);
|
|
| ^^^^^^^^^^^^^^ immutable borrow occurs here
|
|
...
|
|
LL | foo_pin_mut(x);
|
|
| - mutable borrow later used here
|
|
|
|
error[E0499]: cannot borrow `foo` as mutable more than once at a time
|
|
--> $DIR/borrow-mut-xor-share.rs:29:17
|
|
|
|
|
LL | let x = &pin mut foo;
|
|
| ------------ first mutable borrow occurs here
|
|
LL | foo_pin_ref(&pin const foo);
|
|
LL | foo_pin_mut(&pin mut foo);
|
|
| ^^^^^^^^^^^^ second mutable borrow occurs here
|
|
...
|
|
LL | foo_pin_mut(x);
|
|
| - first borrow later used here
|
|
|
|
error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mutable
|
|
--> $DIR/borrow-mut-xor-share.rs:30:13
|
|
|
|
|
LL | let x = &pin mut foo;
|
|
| ------------ mutable borrow occurs here
|
|
...
|
|
LL | foo_ref(&foo);
|
|
| ^^^^ immutable borrow occurs here
|
|
...
|
|
LL | foo_pin_mut(x);
|
|
| - mutable borrow later used here
|
|
|
|
error[E0499]: cannot borrow `foo` as mutable more than once at a time
|
|
--> $DIR/borrow-mut-xor-share.rs:31:13
|
|
|
|
|
LL | let x = &pin mut foo;
|
|
| ------------ first mutable borrow occurs here
|
|
...
|
|
LL | foo_mut(&mut foo);
|
|
| ^^^^^^^^ second mutable borrow occurs here
|
|
LL |
|
|
LL | foo_pin_mut(x);
|
|
| - first borrow later used here
|
|
|
|
error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable
|
|
--> $DIR/borrow-mut-xor-share.rs:38:17
|
|
|
|
|
LL | let x = &pin const foo;
|
|
| -------------- immutable borrow occurs here
|
|
LL | foo_pin_ref(&pin const foo); // ok
|
|
LL | foo_pin_mut(&pin mut foo);
|
|
| ^^^^^^^^^^^^ mutable borrow occurs here
|
|
...
|
|
LL | foo_pin_ref(x);
|
|
| - immutable borrow later used here
|
|
|
|
error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable
|
|
--> $DIR/borrow-mut-xor-share.rs:40:13
|
|
|
|
|
LL | let x = &pin const foo;
|
|
| -------------- immutable borrow occurs here
|
|
...
|
|
LL | foo_mut(&mut foo);
|
|
| ^^^^^^^^ mutable borrow occurs here
|
|
LL |
|
|
LL | foo_pin_ref(x);
|
|
| - immutable borrow later used here
|
|
|
|
error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mutable
|
|
--> $DIR/borrow-mut-xor-share.rs:46:17
|
|
|
|
|
LL | let x = &mut foo;
|
|
| -------- mutable borrow occurs here
|
|
LL | foo_pin_ref(&pin const foo);
|
|
| ^^^^^^^^^^^^^^ immutable borrow occurs here
|
|
...
|
|
LL | foo_mut(x);
|
|
| - mutable borrow later used here
|
|
|
|
error[E0499]: cannot borrow `foo` as mutable more than once at a time
|
|
--> $DIR/borrow-mut-xor-share.rs:47:17
|
|
|
|
|
LL | let x = &mut foo;
|
|
| -------- first mutable borrow occurs here
|
|
LL | foo_pin_ref(&pin const foo);
|
|
LL | foo_pin_mut(&pin mut foo);
|
|
| ^^^^^^^^^^^^ second mutable borrow occurs here
|
|
LL |
|
|
LL | foo_mut(x);
|
|
| - first borrow later used here
|
|
|
|
error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable
|
|
--> $DIR/borrow-mut-xor-share.rs:54:17
|
|
|
|
|
LL | let x = &foo;
|
|
| ---- immutable borrow occurs here
|
|
LL | foo_pin_ref(&pin const foo); // ok
|
|
LL | foo_pin_mut(&pin mut foo);
|
|
| ^^^^^^^^^^^^ mutable borrow occurs here
|
|
LL |
|
|
LL | foo_ref(x);
|
|
| - immutable borrow later used here
|
|
|
|
error: aborting due to 10 previous errors
|
|
|
|
Some errors have detailed explanations: E0499, E0502, E0596.
|
|
For more information about an error, try `rustc --explain E0499`.
|