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.
[ Parent
| on HN ]
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.