Stream: t-compiler/wg-rls-2.0

Topic: Sharing name resolution

matklad (Jul 27 2020 at 17:50, on Zulip):

@Jonas Schievink , here's a sketch of name-res API I've been investigating over the weekend:

matklad (Jul 27 2020 at 17:50, on Zulip):

I think this subset can be shared between rustc & ra in theory

matklad (Jul 27 2020 at 17:52, on Zulip):

where subset:

The set of scopes which store Map<Name, PerNs<Def>>, imports ((Vec<Name>, glob or name or alias)) and has operations for:

This thing should be enough to run the fixed-point loop (the most interesting part)

matklad (Jul 27 2020 at 17:53, on Zulip):

It doesn't know anything about AST (scopes are just bags of names, defs are opaque), hygiene (which is encapsulated into == of names) and which def belongs to which namespaces (the client specifies namespaces explicitely)

Jonas Schievink (Jul 27 2020 at 17:56, on Zulip):

Cool! I guess a good first step would be to make r-a always pass the scope to resolve names in then?

matklad (Jul 27 2020 at 18:10, on Zulip):

Not sure, I might be overlooking things. My plan for this was to create an module in hir_def, with the constraint that it doesnt import db directly, and see how much of name resolution can we spill there.

matklad (Jul 27 2020 at 18:12, on Zulip):

One open question is how to use this thing after names are resolved ? Should we drain scopes back into ModuleDats, or should we use them as is?

matklad (Jul 27 2020 at 18:14, on Zulip):

Should this module extraction succeeded, it would be fun to think about moving this to a crate, with the usual tradeoff:

Last update: Sep 27 2020 at 13:15UTC