book
book copied to clipboard
Mutable reference/mutable variable clarification in Chapter 4.2
trafficstars
Hello. I have started learning Rust and have a small suggestion for chapter 4.2. I think that it's worth it to directly state that you can create a mutable reference only to a mutable variable, meaning that you can't create a mutable reference to an unmutable variable. After reading the chapter I was left with that question in mind ("What if I create a mutable reference to an unmutable variable? Is it even possible?"). Of course that I quickly opened the compiler and checked for my self, but still I think that it's worth adding. Thanks!