Skip to content

Commit 24cd6ce

Browse files
Centrilmatklad
andauthored
Update working-groups/rls-2.0/NOTES.md
Co-Authored-By: matklad <[email protected]>
1 parent 6811c31 commit 24cd6ce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

working-groups/rls-2.0/NOTES.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,6 @@ Cutting diagnostics for initial implementation should help quite a bit, because,
8888

8989
To check correctness of the library we will use `rustc`'s save-analysis infra: it should be much easier than integrating with rustc from the start.
9090

91-
We've also touched a bit on how to make name resolution lazy. One idea was to split it into two separate phases: "item" phase (for items inside modules and bodies) and "expression" phase (for lexical scoping). Unfortunately this does not work: erasing expressions from item bodies can change the meaning of nested items in corner cases. For example, using `let` binding in `use` is an error ([Playground link](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=faf6ea2a0543aa5eac9b503ca0a8b757)). Another, more reasonable idea is to postpone name resolution of item bodies until it is needed in type-checking. Yet another approach is to take "shortcuts" and give potentially wrong results really fast by, for example, not expanding macros. This should be a last-resort approach only: experience with salsa so-far hints that fast, lazy and correct is possible.
91+
We've also touched a bit on how to make name resolution lazy. One idea was to split it into two separate phases: "item" phase (for items inside modules and bodies) and "expression" phase (for lexical scoping). Unfortunately this does not work: erasing expressions from item bodies can change the meaning of nested items in corner cases. For example, using `let` binding in `use` is an error ([Playground link](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=faf6ea2a0543aa5eac9b503ca0a8b757)). Another, more reasonable idea is to postpone name resolution of item bodies until it is needed in type-checking. Yet another approach is to take "shortcuts" and give potentially wrong results really fast by, for example, not expanding macros. This should be a last-resort approach only: experience with salsa so-far hints that fast, lazy, and correct is possible.
9292

9393
The concrete action item here is to extract existing name resolution from rust-analyzer and implementing save-analysis based test harness. While extracting the library, we should carefully think through interface (possibly phrasing it in terms of IR a-la chalk), lest we produce code, tightly coupled to rust-analyzer.

0 commit comments

Comments
 (0)