|
| 1 | +error[E0308]: mismatched types |
| 2 | + --> $DIR/mut-arg-of-borrowed-type-meant-to-be-arg-of-mut-borrow.rs:6:14 |
| 3 | + | |
| 4 | +LL | fn change_object(mut object: &Object) { |
| 5 | + | ------- expected due to this parameter type |
| 6 | +LL | let object2 = Object; |
| 7 | +LL | object = object2; |
| 8 | + | ^^^^^^^ expected `&Object`, found `Object` |
| 9 | + | |
| 10 | +help: consider borrowing here |
| 11 | + | |
| 12 | +LL | object = &object2; |
| 13 | + | + |
| 14 | + |
| 15 | +error: value assigned to `object` is never read |
| 16 | + --> $DIR/mut-arg-of-borrowed-type-meant-to-be-arg-of-mut-borrow.rs:11:5 |
| 17 | + | |
| 18 | +LL | object = &object2; |
| 19 | + | ^^^^^^ |
| 20 | + | |
| 21 | + = help: maybe it is overwritten before being read? |
| 22 | +note: the lint level is defined here |
| 23 | + --> $DIR/mut-arg-of-borrowed-type-meant-to-be-arg-of-mut-borrow.rs:1:9 |
| 24 | + | |
| 25 | +LL | #![deny(unused_assignments, unused_variables)] |
| 26 | + | ^^^^^^^^^^^^^^^^^^ |
| 27 | + |
| 28 | +error: variable `object` is assigned to, but never used |
| 29 | + --> $DIR/mut-arg-of-borrowed-type-meant-to-be-arg-of-mut-borrow.rs:9:23 |
| 30 | + | |
| 31 | +LL | fn change_object2(mut object: &Object) { |
| 32 | + | ^^^^^^ |
| 33 | + | |
| 34 | + = note: consider using `_object` instead |
| 35 | +note: the lint level is defined here |
| 36 | + --> $DIR/mut-arg-of-borrowed-type-meant-to-be-arg-of-mut-borrow.rs:1:29 |
| 37 | + | |
| 38 | +LL | #![deny(unused_assignments, unused_variables)] |
| 39 | + | ^^^^^^^^^^^^^^^^ |
| 40 | + |
| 41 | +error[E0597]: `object2` does not live long enough |
| 42 | + --> $DIR/mut-arg-of-borrowed-type-meant-to-be-arg-of-mut-borrow.rs:11:14 |
| 43 | + | |
| 44 | +LL | fn change_object2(mut object: &Object) { |
| 45 | + | - let's call the lifetime of this reference `'1` |
| 46 | +LL | let object2 = Object; |
| 47 | + | ------- binding `object2` declared here |
| 48 | +LL | object = &object2; |
| 49 | + | ---------^^^^^^^^ |
| 50 | + | | | |
| 51 | + | | borrowed value does not live long enough |
| 52 | + | assignment requires that `object2` is borrowed for `'1` |
| 53 | +... |
| 54 | +LL | } |
| 55 | + | - `object2` dropped here while still borrowed |
| 56 | + |
| 57 | +error: aborting due to 4 previous errors |
| 58 | + |
| 59 | +Some errors have detailed explanations: E0308, E0597. |
| 60 | +For more information about an error, try `rustc --explain E0308`. |
0 commit comments