Skip to content

Use explicit Debug impls when available. #4

@jswrenn

Description

@jswrenn

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions