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

be careful and do your research.

anytime you need to implement anything that shares references (just about any data structure worth its weight in implementation time) you need to use Rc<> and friends.

i am not talking about https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html. fine, this escape hatch is needed.

i am referring to https://doc.rust-lang.org/book/ch15-06-reference-cycles.html.



It's not anytime. It's limited to recursive types with interior mutability. These two conditions are specific to mutable graphs, not just any shared ownership. There are plenty of uses of Rc that cannot possibly cause a cycle.


Ah, I see now. That makes sense. I stand corrected.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: