Skip to content

Rustfmt/pretty-print types in error messages #2358

@eira-fransham

Description

@eira-fransham

For any highly generic library (futures is the one that I hit this issue with a lot) it's easy for types to become unreadable very fast. Even impl Trait only helps so much (we're using Box<Trait> a lot in our code so impl Trait won't get us better error messages). A good solution would be to rustfmt-style pretty-print types in the error messages so that it's possible for humans to parse them. It might be useful to make this optional or otherwise limit the maximum size because I can imagine this causing diesel's types to take hundreds of lines to print. Probably some kind of overrideable heuristic would be useful to implement here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions