There does exist a crate that allows you to turn it off. Unfortunately the compiler will still compiler your code assuming the same exclusive access rules imposed by the borrow checker, so any time you break the borrow checker rules you’re basically guaranteed to segfault.
The rust compiler always assumes mutable pointers are exclusive. This is the crux of your issue with the borrow checker. If you don’t make this assumption, then you can’t automatically drop variables when they fall out of scope, thus the programmer would have to manually allocate memory.
You may prefer even then to allocate memory yourself, but if I was you I would just trust the rust compiler in its assumption that it can optimize programs much better when all pointers are exclusive, and learn to program in a compliant manner
Yeah… I’ve written about this sensitivity before on Lemmy. :) I honestly think this platform is best for memes and agreeing with popular opinions. And that’s fine I guess.
What’s the point of using Rust, if you don’t want to think and program in Rust? If you seriously don’t want to learn and deal with safe code and think every step of it in advance before compilation, then Rust is the wrong language for you. Either use a low level language like C and Zig, which gives you control over the system, but does not have a borrow checker. Or use a language with a runtime check that does this automatically for you without a borrow checker, like Go in example.
unsafe does not disable the borrow checker. It does however give you abilities to circumvent it, namely by letting you dereference pointers, which are not subject to the borrow checker.
Let us know when the borrow checker is optional so I can write it without hurting my brain.
There does exist a crate that allows you to turn it off. Unfortunately the compiler will still compiler your code assuming the same exclusive access rules imposed by the borrow checker, so any time you break the borrow checker rules you’re basically guaranteed to segfault.
The rust compiler always assumes mutable pointers are exclusive. This is the crux of your issue with the borrow checker. If you don’t make this assumption, then you can’t automatically drop variables when they fall out of scope, thus the programmer would have to manually allocate memory.
You may prefer even then to allocate memory yourself, but if I was you I would just trust the rust compiler in its assumption that it can optimize programs much better when all pointers are exclusive, and learn to program in a compliant manner
Bait or not, I’m not sure why you’re getting such a negative reaction. People are getting too sensitive!
Btw, do sanitizers hurt your brain too?
Yeah… I’ve written about this sensitivity before on Lemmy. :) I honestly think this platform is best for memes and agreeing with popular opinions. And that’s fine I guess.
It is. You just need to change the extension to
.c
Or zig. Heard a lot about that one. Haven’t really done any serious testing though.
What’s the point of using Rust, if you don’t want to think and program in Rust? If you seriously don’t want to learn and deal with safe code and think every step of it in advance before compilation, then Rust is the wrong language for you. Either use a low level language like C and Zig, which gives you control over the system, but does not have a borrow checker. Or use a language with a runtime check that does this automatically for you without a borrow checker, like Go in example.
Isn’t it already optional? Just put
unsafe
on everything?unsafe
does not disable the borrow checker. It does however give you abilities to circumvent it, namely by letting you dereference pointers, which are not subject to the borrow checker.OIC. I really need to start learning this language soon, or I won’t be able to understand future memes and rants.