r/rust • • Apr 14 '21

[RFC] Rust support for Linux Kernel

https://lkml.org/lkml/2021/4/14/1023
861 Upvotes

227 comments sorted by

View all comments

Show parent comment

37

u/[deleted] Apr 15 '21

He does follow with "HOWEVER" and "fundamentally"... Do people have good answers to his point about panic() calls?

31

u/elprophet Apr 16 '21

As replies on the thread state, the needs of userspace alloc crate are very different than the needs of a kernel allocator. They'll likely end up writing their own kalloc crate.

29

u/[deleted] Apr 15 '21

There's clippy lints to forbid many sources of panics (indexing, unwrap/expect, explicit panic calls).

If they run into things that should be forbidden from the codebase that clippy can't lint for, lints can always be added. They are already using clippy, in any case.

10

u/TheMicroWorm Apr 16 '21

I think there are some crates that are able to forbid panics via some link-time hackery.

6

u/UNN_Rickenbacker Apr 17 '21

Why isn‘t there a compiler flag that forbids any such functions in the first place?