Skip to content
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

Use explicit Debug impls when available. #4

Open
jswrenn opened this issue Dec 21, 2022 · 0 comments
Open

Use explicit Debug impls when available. #4

jswrenn opened this issue Dec 21, 2022 · 0 comments

Comments

@jswrenn
Copy link
Owner

jswrenn commented Dec 21, 2022

Deflect does not currently have any special handling of collection types (e.g., HashMap, Vec, etc.), so its Debug renderings of these types is very poor. Implementing custom reflections for these types is daunting.

Instead, we should use the Debug impls of types when available, but how can we know the address of <T as Debug>::fmt? On zulip, @bjorn3 suggests:

If it is already codegened, it may be possibly to get the name of this function using the symbol mangling rules and then dlsym it.

Let's give this a shot. Some of the debug impl names are hidden and so aren't returned by dlsym. They are present in the ELF's symbol table though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant