Get all types that implement a trait

Is there a way using any unstable features to just dump the list of all the types that implement a trait? The project I'm working on made heavy use of macros and the like to generate trait impls, which makes the refactoring I need to do a pain. I was thinking of trying to automate it, but I'm not sure if this is currently even possible.

There's no programmatic way that I'm aware of. rustdoc is probably your best bet — if you're doing an absolutely massive refactor it may be worth your while to hook into however it determines implementors.

If they're all in a single crate you could just add an extra required function to the trait. It'll be more difficult if there's multiple implementing crates involved.

1 Like

Does the rustdoc output for the trait list all of the implementors? You might need to build the docs for all involved crates at once.