Re:The long goodbye to C
by steveklabnik on Saturday November 11, 2017 @08:38AM
(#15676320)
When you're writing a kernel in Rust, you aren't using the default heap allocation API; you aren't using the allocation API at all. You could then build any sort of allocation strategy you want. You don't need to wait for the new traits, though of course, using them eventually helps with interoperability.
You're certainly right about "mature way" wrt alignment, but it's something that can be worked around until then.
Re:The long goodbye to C
by tetromino_ on Tuesday November 14, 2017 @04:40PM
(#15699427)
Well, C's default heap allocation API is not suitable for kernel mode either. Compare libc's malloc and the kernel's kmalloc, with the fine-grained control [1] over what kind of allocation to perform.
[1] https://github.com/spotify/linux/blob/master/include/linux/g...
Additionally, alignment constraints are also really important at that level, but rust doesn’t have a mature way to align structures or arrays.
Rust isn’t ready for this space yet.