-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Try to reduce Semantics monomorphisations #5162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This helps less than expected, but still seems like a decent win: And it's not visibly slower: |
| impl_: SemanticsImpl<'db>, | ||
| } | ||
|
|
||
| pub struct SemanticsImpl<'db> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it need to be pub?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. It's now used in the ToDef trait and I changed that to take SemanticsImpl.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right, than let's keep it pub for simplicity
crates/ra_hir/src/semantics.rs
Outdated
| node: &SyntaxNode, | ||
| offset: TextSize, | ||
| ) -> Option<N> { | ||
| self.impl_.find_node_at_offset_with_descend(node, offset) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's inline generic parts of impl_.find_node_at_offset_with_descend here, and leave only non-generic bit in SemanticsImpl here and elsewhere .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that will turn the non-generic bits return impl Iterator<Item=SyntaxNode so that the generic ones can call find_map(N::cast) on them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, returning, returning an impl Trait is OK, as that's still a specific type under the hood.
|
r? @matklad |
|
bors d+ there's a bunch of .js changes somehow |
|
✌️ lnicola can now approve this pull request. To approve and merge a pull request, simply reply with |
|
Sorry, not sure what happened there. bors r=matklad |
|
✌️ matklad can now approve this pull request. To approve and merge a pull request, simply reply with |
|
bors r=matklad |

No description provided.