I have a couple of features I’d like to implement that depend on having type information for Rust source code:
Syntax highlighting with added links to documentation for types and methods of a certain crate. When I display code fragments from a README, doc comments, examples’ source code I’d like to know which spans/tokens are which types and methods, so I can wrap them in exact docs.rs links.
Statistics of most popular functions and types of a Cargo crate, based on usage in all other crates (I can do crater-like run). For this I don’t need to know exact source code positions, just fully* expanded names of types and functions (* but knowing when a type comes from a type alias would be great to count all the custom
What are my options?
For #1 I suppose I could try to use RLS. For #2 I’m thinking about dumping MIR and searching for UFCS, but MIR syntax is not supposed to be parseable.
Is there a place in
rustc where such information could be dumped relatively easily? Are there other tools or compiler output modes that would be useful?