Skip to content
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

rustc: rewrite the HirId validator to only check HIR map compactness. #65837

Closed
wants to merge 4 commits into from

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented Oct 26, 2019

This should be cheaper than the current validator, and not assume item-like owners, but I did have to add a few more kinds of nodes to the HIR map, so that every node with a HirId is in it.

AFAICT, collecting the HIR map in the first place already checks owners, and I didn't want to duplicate any complications to that for #63849 (comment) (making all nodes with a DefId into HirId owners).

I've also cleaned up the errors to be more useful in determining the "neighborhood" of nodes around missing HirIds, at a glance (we can probably do even better but there's little point at this time).

r? @michaelwoerister cc @nikomatsakis

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 26, 2019
@eddyb
Copy link
Member Author

eddyb commented Oct 26, 2019

r? @michaelwoerister

@eddyb
Copy link
Member Author

eddyb commented Oct 26, 2019

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Oct 26, 2019

⌛ Trying commit d85eab33a7ee8d87f351b8debc8c337d67b49282 with merge 4c60a7cbc36d1e73e33c8faf96f5eed91bb95bf9...

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@bors

This comment has been minimized.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 26, 2019
@eddyb
Copy link
Member Author

eddyb commented Oct 26, 2019

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Oct 26, 2019

⌛ Trying commit 26e071163a2f7f97c9bcbddd7bc4841392c52951 with merge 5d5564441d81a42987f56955337921ed997ea920...

@bors
Copy link
Contributor

bors commented Oct 26, 2019

☀️ Try build successful - checks-azure
Build commit: 5d5564441d81a42987f56955337921ed997ea920 (5d5564441d81a42987f56955337921ed997ea920)

@rust-timer
Copy link
Collaborator

Queued 5d5564441d81a42987f56955337921ed997ea920 with parent 084edc4, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit 5d5564441d81a42987f56955337921ed997ea920, comparison URL.

@michaelwoerister
Copy link
Member

Thanks, @eddyb! I've added it to my review queue.

@eddyb eddyb force-pushed the hir-id-compact-validation branch 2 times, most recently from 42c7bbb to 995ad5a Compare October 28, 2019 10:31
@eddyb
Copy link
Member Author

eddyb commented Oct 30, 2019

I think I've found another way of keeping the HIR validator working with non-item-like HirId owners (by adding a new method to hir::intravisit::Visitor for handling entering a new HirId owner), but for the validator itself that's probably unnecessary (as hir::map::collector already checks owners).

I'll probably use that technique to simplify various other visitors, so that they don't end up hardcoding what's an owner and what's not (eventually we might have a "def" concept that replaces it).

EDIT: I've since realized that it would be easier and more productive to just add a hir::Owner (or hir::Root) enum, and let visitors match on it if they want.

@bors

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Nov 7, 2019

☔ The latest upstream changes (presumably #66180) made this pull request unmergeable. Please resolve the merge conflicts.

@joelpalmer
Copy link

Ping from Triage: any updates @eddyb?

@eddyb eddyb added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 13, 2019
@eddyb
Copy link
Member Author

eddyb commented Nov 13, 2019

This has been waiting for a review from @michaelwoerister since #65837 (comment).

@michaelwoerister
Copy link
Member

Yeah, I need to page in a lot of information in order to review this and haven't had the time to do that yet.

@michaelwoerister
Copy link
Member

Before I spend too much time on finding out how the HirId validator works in detail, would it be an option to just hide validation behind a debug_assertion? That would improve performance and we'd still catch errors on CI, right?

@JohnCSimon JohnCSimon added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 24, 2019
@JohnCSimon
Copy link
Member

Ping from triage
@eddyb - can you please address the merge conflicts?
Thank you!

@JohnCSimon
Copy link
Member

Pinging again from triage
@eddyb - can you please address the merge conflicts?
Thank you!

@JohnCSimon
Copy link
Member

Pinging again from triage -
@eddyb - can you please address the comment here #65837 (comment)
and fix the merge conflicts?

@joelpalmer joelpalmer added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 6, 2020
@joelpalmer
Copy link

Ping from Triage: closing due to inactivity. Please re-open with changes @eddyb - Thanks for the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants