-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Allow for crates to define their own fmt or disable it #247
Comments
As written I don't think this would work in practice.
This breaks functionality.
The panic handler is a terminator and most applications won't rely on it having a specific behavior for their functionality (with the exception of the
cc @nagisa who probably have some thoughts about ^
Why is alloc a problem and not core? core contains fmt::Debug and fmt::Display implementations for (almost) all the types defined in it as well as for all primitives. Most of these won't make it to the final binary because the linker will discard everything not referenced by the application.
If you are not using |
I was compiling in release mode and my binary wound up with core::fmt, the only place I could figure it was coming from was core::fmt::Debug/Display in alloc::boxed::Box ¯\_(ツ)_/¯ |
@sajattack you may want to run cargo-call-stack on your program to see what's calling the fmt stuff. @jonas-schievink that sounds more reasonable. I personally keep hearing this "trait objects make your code small / inlining bloats your code" mantra even though all my no_std experience indicates the contrary so I would like to see a Cargo.toml option along the lines of |
@japaric I get this error with cargo call-stack
|
@sajattack please file a bug report in the issue tracker |
Closing this as part of 2024 triage. This is not actionable by the Embedded WG. Only upstream Rust has the power to accept the proposed changes (make the A few notes about fmt bloat:
|
Similar to the panic_fmt of old, which allowed us to provide our own implementations of what to do when panicking, I think we should be able to have our own formatters, and especially to be able to provide an empty fmt, for crates like alloc that use fmt::Display, fmt::Debug, everywhere. Most of the time we have nowhere to display anything so having this huge dependency is a waste.
The text was updated successfully, but these errors were encountered: