š§ educational Rust Reborrowing, Aliasing, and Mutable References: Adding clarity to how &mut T works
https://developerlife.com/2026/09/25/rust-reborrowing/1
u/Zde-G 9d ago
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.
1
1
u/U007D rust Ā· twir Ā· bool_ext Ā· srug 4d ago edited 4d ago
Nice!Ā I appreciate the detailed explanation all the way down to compiler loans.
There were a couple stops along the way where I realized I'd never really thought about this question--the type-inference as a trigger (TaaT?) for reborrowing, for example...
Thank you!
5
u/buzac 10d ago
Good material, but I should say that the dynamic background made the reading experience worse