Re:The end of the kernel Rust experiment
by QuiEgo on Wednesday December 10, 2025 @12:27AM
(#46214388)
Rust still compiles into bigger binary sizes than C, by a small amount. Although it’s such a complex thing depending on your code that it really depends case-by-case, and you can get pretty close. On embedded systems with small amounts of ram (think on the order of 64kbytes), a few extra kb still hurts a lot.
[ Parent
| on HN ]
Re:The end of the kernel Rust experiment
by accelbred on Wednesday December 10, 2025 @11:52AM
(#46220068)
Lack of stable build-std and panic_immediate_abort features result in a order of magnitude size difference for some rust code I have. Using no_std brings it to ~60kb from ~350kb, but still more than the ~40kb for the C version
Re:The end of the kernel Rust experiment
by torginus on Wednesday December 10, 2025 @11:58AM
(#46220182)
Afaik despite Rust not having exceptions, panic still unwinds the stack and executes 'drop'-s the same way C++ does, which means the code retains much of the machinery necessary to support exceptions.
Re:The end of the kernel Rust experiment
by dwattttt on Wednesday December 10, 2025 @03:35PM
(#46223404)
The panic_immediate_abort feature should prevent this. build-std is the name of the feature that recompiles the Rust standard libraries with your chosen profile, so the combination of these two features should result in no unwinding code bloat.
Re:The end of the kernel Rust experiment
by torginus on Wednesday December 10, 2025 @04:05PM
(#46223836)
Are all crates compatible with this feature?
Re:The end of the kernel Rust experiment
by dwattttt on Wednesday December 10, 2025 @04:09PM
(#46223890)
It's possible for a crate to assume there will be unwinding, but given the Rust communities general attitude to exceptions it's not common.
By default, all it means is that unwinding the stack doesn't happen, so Drop implementations don't get called. Which _can_ result in bugs, but they're a fairly familiar kind: it's the same kind of fault if a process is aborted (crashes?), and it doesn't get a chance to finalise external resources.
EDIT: to clarify, the feature isn't really something crates have to opt in to support
Re:The end of the kernel Rust experiment
by steveklabnik on Wednesday December 10, 2025 @04:29PM
(#46224142)
A crate can add a setting in the package that says "hey if you try to build me without unwinding, cause an error, because I need unwinding to work."
I have never run into such a crate in the wild, I don't think.