Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up[wip] Expand Impl API #131
Conversation
This comment has been minimized.
This comment has been minimized.
|
@nrc @steveklabnik I need guidance here of what the API needs to be. A number of issues comes to mind as I started looking at it.
|
This comment has been minimized.
This comment has been minimized.
I would really like to avoid exposing this to users. Ideally we should structure the API so that we don't need ids for impls (have a more hierarchical approach rather than a relational approach, in DB terms). Failing that we should be able to unify the ids more easily here. We already convert every compiler id into a different save-analysis id, and we should be able to add impl ids to the mix too, I think.
Double-check with @steveklabnik and @euclio, but I would think we definitely want this.
method references are fun! So, I think that in for any method reference we need two optional ids - a trait id which refers to the method declared in the trait and an impl id which refers to the implementation. They are both optional because an inherent method does not have a trait id, and in generic context, we don't have the impl id. Impl methods can also be regarded as both a def in their own right and a ref to the trait method. rls-analysis probably needs to have an API which handles this at different levels of abstraction. For a tool like rustdoc, we know we are dealing with a method and so can supply the different ids etc in a very explicit way. For a tool like the RLS, we have only the concepts of defs and refs (though the LSP has added some concept of implementation recently, but I'm not sure how that affects things yet). A ref can only have one def. I'm wary of supplying multiple refs at the same span because I'm not sure that is treated deterministically in all clients. So I think we want to have a single ref which refers to the 'best' def we can find - the impl method if possible, the trait method otherwise. However, that might screw up 'find all refs' and renaming. Perhaps we should expand every ref to include a def id and an optional impl id?
It's complicated, see above. |
This comment has been minimized.
This comment has been minimized.
|
Thanks @nrc. That gives me enough to get going. The plan:
|
This comment has been minimized.
This comment has been minimized.
I'm not quite sure about this one since it is not possible to reference them, I don't think impls need to be defs. Maybe they should be a thing in its own right (I think we do this for imports, but not sure). |
This comment has been minimized.
This comment has been minimized.
|
Okay. I keep them separate. |
algesten
force-pushed the
algesten:rename-trait-fn
branch
from
44bb61b
to
367b46e
Mar 12, 2018
algesten
force-pushed the
algesten:rename-trait-fn
branch
from
367b46e
to
5028132
Mar 12, 2018
This comment has been minimized.
This comment has been minimized.
|
@algesten is this ready for a review? |
This comment has been minimized.
This comment has been minimized.
|
No sorry. I haven't had the time because of holiday followed by work going crazy this week. I hope to get back to it in the next few days. |
algesten commentedMar 4, 2018
This is the second part of this discussion.
The first part was to emit
data::Implfrom save-analysis.This PR is to use that new data and expose it in a palatable API.