then putting the cursor over the c of c.b should jump us to the let c: Foo = ..., and over the b of c.b should jump us to b: ....
This is nothing special, IntelliJ has this already.
My question is: do any existing open source crates do this? I want this data for all identifiers in all *.rs files in all crates. [I want to dump this data, not query it at runtime.]
Is there a simple (and fast) way to acquire this? I want something fast enough I can auto run after every successful cargo build. (so perferably it should not take much longer than a cargo build itself)
Either spin up the server and interact with it like a normal language client or use the ra_ap_hir crate to interact with it like a library.
The ra_ap_hir approach will probably be the most fruitful (you'll probably start at ra_ap_hir::Crate), but it requires more effort and a bit of understanding around rust-analyzer's architecture. I think you should be able to start things by creating your own database type and calling ra_ap_base_db::SourceDatabase::set_crate_graph() to tell it where your crates are.
A nice thing about this approach is you can keep the database instance around between builds (e.g. by making a long-running server that you ping after every build or change) and rust-analyzer's query caching will mean it doesn't need to re-analyze your entire dependency tree.