Panic-free-friendly standard library

⚓ Rust    📅 2026-04-10    👤 surdeus    👁️ 2      

surdeus

When working with a code which is supposed to be panic-free (that is with zero panic machinery linked into the final binary), I periodically encounter functionality from the standard (core) library which does bring this machinery. When examining it in depth it usually becomes clear that this is totally unnecessary and can be rewritten in a panic-free-friendly fashion. Most of the issues are coming and recurring from the core::fmt, here are few examples:

Another one relating to async/await functionality (which can't be easily fixed because of how it is specified):

Now, I am not asking how to fix these specific issues, I wonder how we can change the approach the library functionality is written in a way that allows the downstream developer to decide how to handle their errors? On which level these guidelines are usually documented and how these can be influenced?

1 post - 1 participant

Read full topic

🏷️ Rust_feed