Stream: t-compiler/rust-analyzer

Topic: Reusing RLS name resolution


Xavier Denis (Feb 13 2021 at 22:31, on Zulip):

Hi! I have a quick question, is the RLS name resolution anywhere close to usuable as a library? Or is it too tied into the RLS internals?

Xavier Denis (Feb 13 2021 at 22:33, on Zulip):

really, I only need to resolve Items (function names, type / constructors, etc)

Jonas Schievink [he/him] (Feb 13 2021 at 22:34, on Zulip):

RLS uses rustc's name resolution, rust-analyzer does it in its hir_def crate, which currently is relatively closely tied to its internals

Jonas Schievink [he/him] (Feb 13 2021 at 22:34, on Zulip):

https://github.com/rust-analyzer/rust-analyzer/issues/5922 tracks refactoring it to make it more architecture-independent

Xavier Denis (Feb 13 2021 at 23:00, on Zulip):

huh i cant believe i hadn't heard of rustc_save_analysis

Xavier Denis (Feb 13 2021 at 23:01, on Zulip):

I'm not sure if the info it provides is enough but it might work....

Xavier Denis (Feb 13 2021 at 23:03, on Zulip):

that RA issue seems super interesting

Xavier Denis (Feb 13 2021 at 23:03, on Zulip):

though in either case I need to also get the types for the names once I've resolved them so I might just be stuck with talking directly to rustc

pksunkara (Feb 23 2021 at 07:55, on Zulip):

@Xavier Denis You can use the rust-analyzer hir as lib to resolve stuff. All these crates are being published and cargo-modules is a good example

Last update: Jul 26 2021 at 12:15UTC