Turning off Rust's borrow checker completely (2022)
1–10 of 63 posts
Re: Turning off Rust's borrow checker completely (2022)
#2Re: Turning off Rust's borrow checker completely (2022)
#3[flagged]
Re: Turning off Rust's borrow checker completely (2022)
#4Re: Turning off Rust's borrow checker completely (2022)
#5[flagged]
So the borrow checker is not necessary in Rust?
However you won’t have Rust’s guarantees of fearless concurrency and you expose yourself to other defects related to memory (free after use etc.)
If you understand the language, you even program much of the std libraries with unsafe code in them.
For more info you can consult the Rustonomicon.
Re: Turning off Rust's borrow checker completely (2022)
#6[flagged]
So the borrow checker is not necessary in Rust?
So if you can write perfectly correct code then you never have to deal with it. Just like when you write perfectly correct syntax you never have to work with the syntax checker.
Re: Turning off Rust's borrow checker completely (2022)
#7Earlier quoted context omitted.
So the borrow checker is not necessary in Rust?
Technically the borrow checker only limits the set of valid programs and is not involved with compilation. So if you can write perfectly correct code then you never have to deal with it. Just like when you write perfectly correct syntax you never have to work with the syntax checker.
However, that doesn't mean that you can disregard the semantic rules that it enforces. It is "involved in compilation" in that sense. Even when writing unsafe code, you are expected to keep up the invariants that the language requires, and the rules of the borrow checker are one part of those invariants.
Re: Turning off Rust's borrow checker completely (2022)
#8Earlier quoted context omitted.
Technically the borrow checker only limits the set of valid programs and is not involved with compilation. So if you can write perfectly correct code then you never have to deal with it. Just like when you write perfectly correct syntax you never have to work with the syntax checker.
To be a bit more precise: the borrow checker does not change the code generation part of the compiler. If you modified rustc to skip borrow checking, and you passed it a valid Rust program, you would get identical output. However, that doesn't mean that you can disregard the semantic rules that it enforces. It is "involved in compilation" in that sense. Even when writing unsafe code, you are expected to keep up the i…
That the borrow checker does not influence compilation and just determines if a program is valid or not.
Just like you can ignore the syntax checker of languages as long as you never give it incorrect syntax.
I guess my core concept is that you wouldn't do these things because they provide value. And that removing the rust borrow checker without restricting what programs you write does not make sense just like trying to pass incorrect syntax to a compiler with the syntax checker removed.
That to remove the borrow checker would still require you to still follow all the rules of the borrow checker! Now you just don't know if you did it correctly or not.
Re: Turning off Rust's borrow checker completely (2022)
#9[flagged]