summaryrefslogtreecommitdiff
path: root/Mutable references are safe because they prevent aliasing.md
blob: 13ee277823da31a1604c9e87390c179785f89926 (plain)
1
2
3
4
5
6
7
[[Pointer safety principle]]
[[Aliasing just means that multiple variables point to the same heap data]]
[[Downgrading a mutable reference]]

---

A reference that is mutable is created with `&mut` . They are safe because all permissions are dropped from the borrowed place so it can not be read while the reference exists. It is therefore not an alias.