Banning unsafe in Rust for Linux device drivers
Banning unsafe in Rust for Linux device drivers
Posted Aug 15, 2024 14:29 UTC (Thu) by farnz (subscriber, #17727)In reply to: Safe embedded code is state of the art by DanilaBerezin
Parent article: Standards for use of unsafe Rust in the kernel
I don't see a ban on unsafe as being something imposed - there will not be a decree saying that "unsafe in drivers is not allowed", or a #[deny(unsafe_code)] equivalent enforced on drivers. Rather, the decree will be "don't use unsafe when there's a suitable safe abstraction you can use at no performance cost", and in the long run, this will be equivalent to a complete ban on unsafe code, since there will always be a safe abstraction you can use.
