Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> > Like why do I need to use `addr_of_mut!`?

> As of Rust 1.82.0 [0] you no longer need to!

That's true but misleading. I'm pretty sure the question was why a normal reference is bad. You don't need `addr_of_mut!()`, but you do need `&raw mut`.



> I'm pretty sure the question was why a normal reference is bad.

Oh, completely missed that interpretation. I think in that case it comes down to references being incompatible with the desired semantics for an intrusive list - & doesn't work if you want to modify what you're pointing to, and &mut doesn't work since you may want multiple things to be able to point to and modify whatever you're pointing to.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: