rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.08k stars 1.57k forks source link

Do more name resolution in body lowering #14498

Open Veykril opened 1 year ago

Veykril commented 1 year ago

Right now body lowering is just that, going from AST -> HIR, all resolution actually happens in type checking. This makes the inference query a lot more complicated than it needs to be. Some things we should probably resolve are labels, lifetimes (unsure about this one) and paths (only partially given paths might require type info for full resolution).

cc https://github.com/rust-lang/rust-analyzer/pull/14368#discussion_r1139941211

Veykril commented 1 year ago

This is now getting more messy with our half backed addition of lang paths and https://github.com/rust-lang/rust-analyzer/pull/15559 adding an assoc path segment to that

Veykril commented 6 months ago

Actually, we might want to lift his name resolution into another query. Body queries currently depend on the AstIdMap which gets invalidated on every change in a file causing us to recalculate all bodies. So making that query slower is not necessarily a good idea.