On Borrow Checking

Don Allen donaldcallen at gmail.com
Wed May 7 03:09:49 UTC 2025


On Sunday, 4 May 2025 at 11:02:27 UTC, Paul Backus wrote:
> On Saturday, 3 May 2025 at 19:22:20 UTC, Walter Bright wrote:
>> In Rust you can use "unsafe" to avoid the borrow checker.
>
> Also, this is not true, which you would know if you had read 
> literally anything about unsafe Rust:
>
>> You can take five actions in unsafe Rust that you can’t in 
>> safe Rust, which we call unsafe superpowers. Those superpowers 
>> include the ability to:
>>
>> * Dereference a raw pointer
>> * Call an unsafe function or method
>> * Access or modify a mutable static variable
>> * Implement an unsafe trait
>> * Access fields of a union
>>
>> It’s important to understand that unsafe doesn’t turn off the 
>> borrow checker or disable any other of Rust’s safety checks
>
> Source: https://doc.rust-lang.org/book/ch20-01-unsafe-rust.html
>
> This page is the first result on Google for "unsafe rust". The 
> fact that you got this wrong shows very clearly that you have 
> not done your homework on this topic.

Walter's admission that he has not written even a single line of 
Rust code raises a similar concern. Reading Rust documentation is 
necessary but not sufficient for acquiring a real understanding 
of the borrow checker (would you get into a self-driving car 
having software written by someone who doesn't drive?). I've 
written about 10000 lines of working Rust code, so while I would 
not claim to be the world's preeminent expert on the language, 
I've been in the trenches with it. You cannot learn from reading 
a book what this taught me.

This also strikes me as an instance of gluing yet another wart 
onto this language.


More information about the Digitalmars-d mailing list