Re:The borrowchecker is what I like the least about Rust
by zozbot234 on Sunday July 20, 2025 @02:12AM
(#44622424)
You can freely alias &Cell<T>, and this would give you memory safety compared to raw pointers. AIUI, &Cell<T> is effectively the moral equivalent (but safe) to T* in C/C++.
[ Parent
| on HN ]
Re:The borrowchecker is what I like the least about Rust
by int_19h on Sunday July 20, 2025 @04:51PM
(#44629205)
It works if you only ever need to reference the outer value, but it doesn't allow you to e.g. get a working mutable reference to a field inside a struct - even if you declare the field as another Cell<T>, when you read the value from the outer cell, you get a copy, not a reference to original. And the same thing goes for arrays, which is especially inconvenient. So no, not quite equivalent.