Hi! We’ve started to work on the type inference in IntelliJ Rust, and one of the interesting problems there is finding an impl, given the type and the trait. I’ve written down my thoughts about how this can be achieved within IntelliJ indexing infrastructure in this issue. Perhaps it would be interesting for people working on the RLS.
The RLS will use the compiler and thus have access to the trait selection infrastructure. That seems like the most straight-forward approach, IMO.
I am curious, at what level of incrementality would RLS operate? My understanding is that RLS will periodically schedule a full rebuild of a crate, and would record a result of that process into some kind of an index (sort of like https://www.kythe.io/). The approach in IntelliJ is, in some sense, the opposite: we index the source code on a per file basis after parsing, but before name resolution and type inference, and then use the indexes to quickly recalculate all the semantic information as the user edits the code.