-
-
Notifications
You must be signed in to change notification settings - Fork 160
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
Dependence on fmt::Debug
#296
Comments
As an opt-in compiler flag, I think it's fine that it causes some proc macros to not work. I don't think special consideration needs to be built into the option to behave differently in proc macros. That said, motivation number 1 in rust-lang/rust#123940 (comment) does not apply to proc macros. If motivation 1 is most of the sincere motivation for this option, and motivation 2 is much less valuable to anyone in practice, then it might be nice if you could make {:?} behave normally in proc macros. That sounds hard though, at least when Cargo's "cross compile mode" is not in effect (i.e. when |
Thanks for the response and the code update. |
I'm proposing an option to disable
fmt::Debug
, mainly to reduce executable sizes, and to thoroughly strip symbol names from executables.When testing it, it quickly became apparent that
thiserror
usesfmt::Debug
, and this is a common pattern in proc macros.I wanted to check how you feel about an option "breaking"
fmt::Debug
. Shallfmt::Debug
be guaranteed to work in proc-macros? Would you be okay changing the implementation to use something else to stringify enums? (strum
'sDisplay
, or manualmatch … => "…"
). I'm also proposing to add#[cfg(debug_fmt_detail = "full")]
to let crates usefmt::Debug
when it's on, and fall back to something else when it's a no-op.The text was updated successfully, but these errors were encountered: