|
|
Log in / Subscribe / Register

Fixing developers instead of the tools?

Fixing developers instead of the tools?

Posted Sep 22, 2021 11:35 UTC (Wed) by khim (subscriber, #9252)
In reply to: Fixing developers instead of the tools? by cagrazia
Parent article: More Rust concepts for the kernel

Nah. unsafe is perfectly valid tool in Rust. After all hardware itself is “unsafe” thus someone have to deal with it.

Only Rust have a culture of providing safe abstractions on top of unsafe code. That is: if you tried really hard yet all existing safe abstractions don't work for you then it's time to invent a new one, not to time go and use unsafe everywhere.


to post comments

Fixing developers instead of the tools?

Posted Sep 23, 2021 13:33 UTC (Thu) by farnz (subscriber, #17727) [Link]

Also, as a code reviewer, unsafe is a big red flag that I need to pay attention to the details here, whereas in C, you can sneak UB past me. That helps continue the culture of "encapsulate unsafe in safe interfaces", because your reviewers don't like reviewing unsafe Rust.

Fixing developers instead of the tools?

Posted Sep 26, 2021 13:53 UTC (Sun) by droundy (guest, #4559) [Link]

Yes, and that is why unsafe is so hard, because you have not only to write code that has no undefined behavior, but also to write an interface that prevents any user with any mistakes from possibly causing undefined behavior, even if they do things that you document shouldn't be done.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds