Single Mutable Reference

Rust is really picky about all this mutation stuff. We already mentioned that you can’t mutate a value that’s borrowed. This same basic logic extends to mutable references. If you have a mutable reference to a value, you can’t mutate or read that value anywhere else in your program. We call this freezing. To demonstrate, this program is fine:

Get hands-on with 1000+ tech skills courses.

Learn to code, grow your skills, and succeed in your tech interview