summaryrefslogtreecommitdiff
path: root/Mutable references are safe because they prevent aliasing.md
blob: bb837f703cc045fdf51f34dd1c016752cd0bf4ea (plain)
1
2
3
4
5
6
7
[[Pointer safety principle]]
[[Aliasing is accessing the same data through different variables]]
[[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.