Skip to content

Cargo list trait implementors #14852

Open
@walksanatora

Description

@walksanatora

Problem

I am writing a program and would like a way to see every struct that implements a trait (eg: serde::Serialize)
I know that at somepoint during compilation the full type information is avaliable because rust is able to give output like

     = help: the following other types implement trait `_::_serde::Serialize`:
               &'a T
               &'a mut T
               ()
               (T,)
               (T0, T1)
               (T0, T1, T2)
               (T0, T1, T2, T3)
               (T0, T1, T2, T3, T4)
             and 150 others

when using types that dont implement a trait.

Proposed Solution

if I had to guess this would probally be best relegated to some kind of nightly -Z flag probally smth like -Z dump-impls probally producing either a debug output dump of the crates. or just a simple tabulated tree of crates and traits and impls

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-new-subcommandArea: new subcommandC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions