3 ms·
Linus' comments are surprising to me. First, I would have thought that Rust is far too much like C++ for him. :-) Second, he seems remarkably calm about the v
by mcguire 6y ago
Linus' comments are surprising to me.
First, I would have thought that Rust is far too much like C++ for him. :-)
Second, he seems remarkably calm about the very idea of a compiler inserting memory allocations in kernel code. He's only talking about panics. It's been a long time since I was involved in any kernel code, but invisible allocations would have set me (and any kernel programmers I knew) off worse than the worst rant anyone has ever seen from Linus. Any kind of invisible things (destructors, anyone?) would.
- gpm 6y ago> but invisible allocations would have set me (and any kernel programmers I knew) off worse than the worst rant anyone has ever seen from Linus Reading tea leaves here, but I think he's calm about this because he's pretty sure it's not happening (Which it isn't)
- paavohtl 6y agoRust doesn't have invisible allocations. The compiler doesn't even know what an allocation is.
- mcguire 6y ago"So if the Rust compiler causes hidden allocations that cannot be caught and returned as errors, then I seriously think that this whole approach needs to be entirely NAK'ed, and the Rust infrastructure - whether at the compiler level or in the kernel wrappers - needs more work." So Linus is worried about nothing?
- paavohtl 6y agoYes, basically. The Rust standard library has data structures and functions which require memory allocation, and _will_ panic on allocation failure. But the allocating subset of the standard library is a separate module, which is usually turned off in embedded or kernel-level code. The current prototype uses it to speed up development, but the long term plan as far as I understand is to replace it or augment the current implementation to support fallible allocation (which is being worked on anyway).
- mlindner 6y ago> he seems remarkably calm about the very idea of a compiler inserting memory allocations in kernel code Rust doesn't insert memory allocations anywhere. You can use Rust without a heap even in stack-only environments. Just like C.