|
| 1 | +error[E0596]: cannot borrow `*string` as mutable, as it is behind a `&` reference |
| 2 | + --> $DIR/suggest-use-as-mut-for-map.rs:28:5 |
| 3 | + | |
| 4 | +LL | string.push_str("test"); |
| 5 | + | ^^^^^^ `string` is a `&` reference, so the data it refers to cannot be borrowed as mutable |
| 6 | + | |
| 7 | +help: consider changing this to be a mutable reference |
| 8 | + | |
| 9 | +LL | let string = &mut map[&0]; |
| 10 | + | +++ |
| 11 | + |
| 12 | +error[E0596]: cannot borrow `*string` as mutable, as it is behind a `&` reference |
| 13 | + --> $DIR/suggest-use-as-mut-for-map.rs:34:5 |
| 14 | + | |
| 15 | +LL | string.push_str("test"); |
| 16 | + | ^^^^^^ `string` is a `&` reference, so the data it refers to cannot be borrowed as mutable |
| 17 | + | |
| 18 | +help: consider changing this to be a mutable reference |
| 19 | + | |
| 20 | +LL | let string = &mut map[&0]; |
| 21 | + | +++ |
| 22 | + |
| 23 | +error[E0596]: cannot borrow `*string` as mutable, as it is behind a `&` reference |
| 24 | + --> $DIR/suggest-use-as-mut-for-map.rs:38:5 |
| 25 | + | |
| 26 | +LL | string.push_str("test"); |
| 27 | + | ^^^^^^ `string` is a `&` reference, so the data it refers to cannot be borrowed as mutable |
| 28 | + | |
| 29 | +help: consider changing this to be a mutable reference |
| 30 | + | |
| 31 | +LL | let string = &mut vec[0]; |
| 32 | + | +++ |
| 33 | + |
| 34 | +error[E0596]: cannot borrow `*string_ref` as mutable, as it is behind a `&` reference |
| 35 | + --> $DIR/suggest-use-as-mut-for-map.rs:43:5 |
| 36 | + | |
| 37 | +LL | string_ref.push_str("test"); |
| 38 | + | ^^^^^^^^^^ `string_ref` is a `&` reference, so the data it refers to cannot be borrowed as mutable |
| 39 | + | |
| 40 | +help: consider changing this to be a mutable reference |
| 41 | + | |
| 42 | +LL | let string_ref = &mut read_only_vec[0]; |
| 43 | + | +++ |
| 44 | + |
| 45 | +error: aborting due to 4 previous errors |
| 46 | + |
| 47 | +For more information about this error, try `rustc --explain E0596`. |
0 commit comments