-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Generate metadata by iterating on DefId instead of traversing the HIR tree 1/N #80919
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
064a351
Infallible version of def_span.
cjgillot 0b6c9e9
Encode DefKind directly.
cjgillot c58a6fa
Iterate DefId to encode spans.
cjgillot a185cdb
Iterate to encode def_kind.
cjgillot f1bf6d0
Iterate DefId to encode visibility.
cjgillot 293e885
Iterate DefId to encode attributes.
cjgillot 7a5620c
Iterate DefId to encode expn_that_defined.
cjgillot f1a7e1d
Iterate on stability.
cjgillot 4468473
Iterate on const_stability.
cjgillot 4e60ecf
Iterate on deprecation.
cjgillot 4eb0bbd
Filter stability.
cjgillot 8936093
Fix proc macro crate encoding.
cjgillot 97ee7c7
Allow to query the HIR crate node.
cjgillot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Iterate DefId to encode visibility.
- Loading branch information
commit f1bf6d0e48fdf5be3c3a1264b5d0ef8f1f272e5f
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
One possibility would be to add an intermediate
visibilities
query which is just a map from local def ids to visibilities and have thevisibility
query fetch its information from that instead of from the HIR directly. Then we could iterate thatvisibilities
query result here instead of invokingvisibility
on a certain set of visibilities. That would duplicate all visibility entries though, so it's not ideal either.For the reduce of complexity, I'm fine merging the PR as it is and taking the up to 1% perf regression
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 don't understand. Isn't that what the visibility query does already? It fetches the visibilities computed by resolving, and corrects the missing elements. I can investigate doing this eagerly during HIR indexing.
If you are ok with the large
if let
, I will remove thevisibility -> try_visibility
rename before merging.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.
Oh... I guess then you can remove the visibiliy query check entirely and just iterate the
tcx.visibilites
(instead of all def ids) to find out which visibility queries to run? Not sure if that is too hacky, maybe we should uplifttcx.visibilities
to a query that just returns the field... cc @petrochenkovThere 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.
The
tcx.visibilities
table is incomplete, it's not enough to iterate it to encode all visibilities.In theory is can be completed during AST lowering, but filling the missing entries on the fly in the query was simpler.
If the table is completed during AST lowering, then iterating it will be enough to encode all visibilities.