3 ms·
You'd know better than me, but to my knowledge the borrow checker prevents having aliasing mutable references without unsafe (or cell). Leaving aside the merits
by AlotOfReading 7y ago
You'd know better than me, but to my knowledge the borrow checker prevents having aliasing mutable references without unsafe (or cell). Leaving aside the merits of actually doing this in real code, it's ultimately something the compiler has to consider.
Similarly, is splitting borrows still an issue? I think that'd apply here as well, and has a much more legitimate purpose in real code.
- steveklabnik 7y agoSure. But UnsafeCell is a part of the language. So if we're comparing the language to the language, then they're equivalent. It's only if you say "no unsafe Rust and no unsafe rust in anything you use" that this wouldn't be true, and that also means any program is effectively impossible (to print something to the screen, you need to talk to the OS, and that's unsafe!) > Similarly, is splitting borrows still an issue? It depends on exactly what you mean, there's a few different patterns that people mean when they mean "splitting borrows" and one of them has a camp of people who don't think that's a problem, but a feature.