Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

> I wouldn't be surprised if they would simply turn to unsafe if they had to write it in Rust, errors are apparently to be worked around not fixed.

They probably would. But it's easier to find usages of unsafe through grep or the like than it is with C because Rust's syntax and requirement of marking unsafe make it easier to find. To use one of my own codebases for example, I can look at the instances of the following regex patterns:

    * "\bfn\b" (function declarations), 138 matches.
    * "\bunsafe\s+fn\b" or "\bunsafe\s+extern\b" (unsafe function declarations), 23 total.
    * "\bunsafe\s*\{" (opening an unsafe block), 41 matches.
    * "\bunsafe\s+impl" (unsafe trait implementation), 0 matches.
We can also look at the total lines of code written (2269), and ask if this these numbers feel reasonable for what it's doing. Obviously that will require familiarity with Rust, what's being implemented, and the expected amount of unsafe based on previous usage in the kernel, but it would at least give an overall feel. And, of course, if you want to examine any of them, you know exactly where they are.


view as:

Legal | privacy