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

> I think you meant “borrow checker” because sure it does. It’s called a const reference. Want a mut borrow? That’s a pointer.

These have very different semantics. Lexically you can only have either 1 mutable reference or N immutable references at a time to a given object. This is the foundation for a lot of the safety and aliasing [2] guarantees. Just because they both use an '&' doesn't make them equivalent! :)

Don't get my started on `std::move` which doesn't really move, and continues to allow you to use the source object - in whatever condition it may be in. These are also not the same. C++ move semantics are sort of the 'ruined fresco' [1] of Rust move semantics.

[1] https://www.npr.org/sections/thetwo-way/2012/09/20/161466361...

[2] https://doc.rust-lang.org/nomicon/aliasing.html



Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: