Skip to content

Save-analysis data should indicate whether an item is visible from the crate root #43521

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

Closed
euclio opened this issue Jul 28, 2017 · 2 comments
Closed
Labels
A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. C-feature-request Category: A feature request, i.e: not implemented / a PR. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@euclio
Copy link
Contributor

euclio commented Jul 28, 2017

This is needed for tools like the new rustdoc prototype at steveklabnik/rustdoc, where it's required to only document items that can be used by the library consumer.

This should also take pub use into account.

cc rust-dev-tools/rls-analysis#79

@steveklabnik steveklabnik added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 28, 2017
@Mark-Simulacrum Mark-Simulacrum added A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. C-feature-request Category: A feature request, i.e: not implemented / a PR. labels Jul 28, 2017
@nrc
Copy link
Member

nrc commented Aug 2, 2017

cc me

To be clear, I think we should be able to filter data based on whether it is visible, I don't think save-analysis needs to contain that info.

@euclio
Copy link
Contributor Author

euclio commented Nov 2, 2017

@nrc

I've started working on this. Could you offer any advice around how to correctly handle pub use? I'm thinking something along the lines of: on encountering a pub use, I should additionally see if the used item is reachable. If it is, dump the item even if it's not reachable.

bors added a commit that referenced this issue Nov 23, 2017
Allow filtering analysis by reachability

Fixes #43521.
Fixes rust-dev-tools/rls-analysis#79.

This PR allows a user to filter items present in the save-analysis data by setting the `reachable_only` config option. This option is intended for use by the new rustdoc. The PR isn't quite finished, because it's dependent on a new release of rls-data, but I want to make sure that the approach is valid.

rust-dev-tools/rls-analysis#79 mentions that `pub use` might need to be handled, but my thinking is that the consumer of the analysis data would be able to infer which imports are `pub use`, and which items are only reachable through `pub use`, so that doesn't need to be handled here.

r? @nrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. C-feature-request Category: A feature request, i.e: not implemented / a PR. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants