Making Rust core and alloc panic free

Hypothetically if core/std had a mechanism like Cargo features (ala the std-aware Cargo work), one of the on-by-default features could be panic.

Disabling the feature could disable the entire panic subsystem and any APIs which use it.

This would be particularly nice as a way of ensuring code is panic-free: instead of linting code with "panic detectors", anything that causes a panic would become a compile error.

This is beneficial for many environments where panics are considered an antifeature, including the aforementioned embedded space, but also the Linux kernel.

14 Likes