|
| 1 | +error[E0596]: cannot borrow `foo` as mutable, as it is not declared as mutable |
| 2 | + --> $DIR/borrow-mut-xor-share.rs:24:17 |
| 3 | + | |
| 4 | +LL | foo_pin_mut(&pin mut foo); |
| 5 | + | ^^^^^^^^^^^^ cannot borrow as mutable |
| 6 | + | |
| 7 | +help: consider changing this to be mutable |
| 8 | + | |
| 9 | +LL | let mut foo = Foo; |
| 10 | + | +++ |
| 11 | + |
| 12 | +error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mutable |
| 13 | + --> $DIR/borrow-mut-xor-share.rs:28:17 |
| 14 | + | |
| 15 | +LL | let x = &pin mut foo; |
| 16 | + | ------------ mutable borrow occurs here |
| 17 | +LL | foo_pin_ref(&pin const foo); |
| 18 | + | ^^^^^^^^^^^^^^ immutable borrow occurs here |
| 19 | +... |
| 20 | +LL | foo_pin_mut(x); |
| 21 | + | - mutable borrow later used here |
| 22 | + |
| 23 | +error[E0499]: cannot borrow `foo` as mutable more than once at a time |
| 24 | + --> $DIR/borrow-mut-xor-share.rs:29:17 |
| 25 | + | |
| 26 | +LL | let x = &pin mut foo; |
| 27 | + | ------------ first mutable borrow occurs here |
| 28 | +LL | foo_pin_ref(&pin const foo); |
| 29 | +LL | foo_pin_mut(&pin mut foo); |
| 30 | + | ^^^^^^^^^^^^ second mutable borrow occurs here |
| 31 | +... |
| 32 | +LL | foo_pin_mut(x); |
| 33 | + | - first borrow later used here |
| 34 | + |
| 35 | +error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mutable |
| 36 | + --> $DIR/borrow-mut-xor-share.rs:30:13 |
| 37 | + | |
| 38 | +LL | let x = &pin mut foo; |
| 39 | + | ------------ mutable borrow occurs here |
| 40 | +... |
| 41 | +LL | foo_ref(&foo); |
| 42 | + | ^^^^ immutable borrow occurs here |
| 43 | +... |
| 44 | +LL | foo_pin_mut(x); |
| 45 | + | - mutable borrow later used here |
| 46 | + |
| 47 | +error[E0499]: cannot borrow `foo` as mutable more than once at a time |
| 48 | + --> $DIR/borrow-mut-xor-share.rs:31:13 |
| 49 | + | |
| 50 | +LL | let x = &pin mut foo; |
| 51 | + | ------------ first mutable borrow occurs here |
| 52 | +... |
| 53 | +LL | foo_mut(&mut foo); |
| 54 | + | ^^^^^^^^ second mutable borrow occurs here |
| 55 | +LL | |
| 56 | +LL | foo_pin_mut(x); |
| 57 | + | - first borrow later used here |
| 58 | + |
| 59 | +error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable |
| 60 | + --> $DIR/borrow-mut-xor-share.rs:38:17 |
| 61 | + | |
| 62 | +LL | let x = &pin const foo; |
| 63 | + | -------------- immutable borrow occurs here |
| 64 | +LL | foo_pin_ref(&pin const foo); // ok |
| 65 | +LL | foo_pin_mut(&pin mut foo); |
| 66 | + | ^^^^^^^^^^^^ mutable borrow occurs here |
| 67 | +... |
| 68 | +LL | foo_pin_ref(x); |
| 69 | + | - immutable borrow later used here |
| 70 | + |
| 71 | +error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable |
| 72 | + --> $DIR/borrow-mut-xor-share.rs:40:13 |
| 73 | + | |
| 74 | +LL | let x = &pin const foo; |
| 75 | + | -------------- immutable borrow occurs here |
| 76 | +... |
| 77 | +LL | foo_mut(&mut foo); |
| 78 | + | ^^^^^^^^ mutable borrow occurs here |
| 79 | +LL | |
| 80 | +LL | foo_pin_ref(x); |
| 81 | + | - immutable borrow later used here |
| 82 | + |
| 83 | +error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mutable |
| 84 | + --> $DIR/borrow-mut-xor-share.rs:46:17 |
| 85 | + | |
| 86 | +LL | let x = &mut foo; |
| 87 | + | -------- mutable borrow occurs here |
| 88 | +LL | foo_pin_ref(&pin const foo); |
| 89 | + | ^^^^^^^^^^^^^^ immutable borrow occurs here |
| 90 | +... |
| 91 | +LL | foo_mut(x); |
| 92 | + | - mutable borrow later used here |
| 93 | + |
| 94 | +error[E0499]: cannot borrow `foo` as mutable more than once at a time |
| 95 | + --> $DIR/borrow-mut-xor-share.rs:47:17 |
| 96 | + | |
| 97 | +LL | let x = &mut foo; |
| 98 | + | -------- first mutable borrow occurs here |
| 99 | +LL | foo_pin_ref(&pin const foo); |
| 100 | +LL | foo_pin_mut(&pin mut foo); |
| 101 | + | ^^^^^^^^^^^^ second mutable borrow occurs here |
| 102 | +LL | |
| 103 | +LL | foo_mut(x); |
| 104 | + | - first borrow later used here |
| 105 | + |
| 106 | +error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable |
| 107 | + --> $DIR/borrow-mut-xor-share.rs:54:17 |
| 108 | + | |
| 109 | +LL | let x = &foo; |
| 110 | + | ---- immutable borrow occurs here |
| 111 | +LL | foo_pin_ref(&pin const foo); // ok |
| 112 | +LL | foo_pin_mut(&pin mut foo); |
| 113 | + | ^^^^^^^^^^^^ mutable borrow occurs here |
| 114 | +LL | |
| 115 | +LL | foo_ref(x); |
| 116 | + | - immutable borrow later used here |
| 117 | + |
| 118 | +error: aborting due to 10 previous errors |
| 119 | + |
| 120 | +Some errors have detailed explanations: E0499, E0502, E0596. |
| 121 | +For more information about an error, try `rustc --explain E0499`. |
0 commit comments