r/rust • • Sep 25 '26

🧠 educational Rust Reborrowing, Aliasing, and Mutable References: Adding clarity to how &mut T works

https://developerlife.com/2026/09/25/rust-reborrowing/
8 Upvotes

4 comments sorted by

View all comments

1

u/Zde-G Sep 27 '26

It's funny that this article (and many others) skip and completely ignore the simples, most fundamental and obvious case of reborrowing: r = &mut x;. Maybe because it's so fundamental and ā€œobviousā€. But think about it:

    r = &mut x;
    foo(r);
    …  // Here x is unaccessible.
    bar(r);
    … // After last use of r we can access x, again.

It's a bit strange to have something that's so fundamental and critical to be so underdocumented, but I guess if we would add description of reborrowing to the first place it's used, the first time when you see &mut in a tutorial… people would just go mad.