Closed
Description
The following snippet:
fn main() {
let ref my_ref @ _ = 0;
*my_ref = 0
}
Produces the following output:
error[E0594]: cannot assign to immutable borrowed content `*my_ref`
--> src/main.rs:3:5
|
2 | let ref my_ref @ _ = 0;
| -------------- consider changing this to `ref mut my_ref mut @ _`
3 | *my_ref = 0
| ^^^^^^^^^^^ cannot borrow as mutable
Note that the label suggests invalid syntax. I believe this happens due to the text replacement in the following code:
rust/src/librustc_borrowck/borrowck/mod.rs
Lines 1210 to 1219 in e38554c