Hi Internals list,
I’ve come to a halt with Racer recently because I’m unclear how to progress wrt type analysis.
- racer needs rustc’s help in order to perform ‘perfect’ type analysis
- rustc’s internal api is unstable (because the api changes regularly)
- rustc is tightly coupled to the build artifacts it generates (e.g. .rlibs)
Unfortunately (2) means currently a rustc-enabled racer cannot be built with stable rust, and (3) means a rustc-enabled racer built with nightly rust cannot process stable rlib artifacts to derive completions (I think - is this true?).
So actually racer needs to be built against rustc stable (I think). Does anybody have a good idea for how to solve this problem?
One possibility would be to expose a stable coarse grained api for distribution with rustc, maybe in a separate lib. E.g. something like:
let ctx = setup_compiler(args); let path = ctx.resolve_type_of_expr(search_file, span);
Where args is an array of command line args [&String] in the same format as rustc takes, ‘search_file’ and ‘span’ compose the coordinates of an expression and resolve_type_of_expr returns a Path encoded as a String. (span coordinates would be local to the file rather than the crate)
This isn’t a great solution, but I don’t have any others. Would the team be open to a PR with this sort of api? Any altenative suggestions would be gratefully appreciated!
Thanks very much!