-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
HIR: introduce a HirId to DefId map in Definitions #63849
Conversation
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
@bors try |
⌛ Trying commit f71703abf45b28712dc34890d85d67991f8400a4 with merge 8a50d3d384210ef535686e4c3804884fede9a4de... |
☀️ Try build successful - checks-azure |
r? @Zoxc |
This should get a perf run, shouldn't it? |
Yeah, I'd suggest doing that; I don't have perf creds, though. |
@rust-timer build 8a50d3d384210ef535686e4c3804884fede9a4de Feel free to ping me if you need a perf run |
Success: Queued 8a50d3d384210ef535686e4c3804884fede9a4de with parent 4784645, comparison URL. |
Finished benchmarking try commit 8a50d3d384210ef535686e4c3804884fede9a4de, comparison URL. |
Not too shabby; @Zoxc you said you'd recommend someone else to review this specific change - can you suggest someone? |
Triage: Requesting a review from @rust-lang/compiler |
Hmm, my read of the performance results is that this is basically neutral. It looked like almost everything was 0% except for one 1%, and that was for a known unreliable case. Am I mis-reading? If not, I'd be inclined to leave things as they are, as @ljedrz noted that this change increased the complexity of the code. |
@nikomatsakis This is a necessary step for the deprecation of |
@ljedrz ah sorry, I misunderstood the motivation. I thought this was a performance optimization. |
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.
@ljedrz -- the code here looks good! But one thing I was missing is a bit of context. Maybe you can add a comment that helps to clarify why the HirId-DefId mapping for these cases is different?
Clearly, it has to do with defs that are "synthesized" during lowering, but if you could say a bit more I think it'd be helpful for future readers. :)
f71703a
to
bb00048
Compare
@nikomatsakis I rebased and expanded on the previous comments. |
I don't know where I last suggested it but IMO it would probably be nicer to have every node with a |
@eddyb that does indeed sound pretty clean, but it seems like a larger scale refactoring -- how hard do you think it would be? |
It shouldn't be that hard, I think there a "whitelist" of The main exception is |
What are the interactions with incremental compilation? That's why we introduced |
@eddyb is there a canonical list of "things that have def-ids"? To be honest I might be a little out of date on the current status here. (This actually feels like a case where I'd have appreciated a design meeting, or at least some up-front docs on what the plans are -- @ljedrz I'm kind of assuming those don't exist? (Don't feel bad, it's not standard practice.)) |
@nikomatsakis I don't mind at all ^^. Nah, they don't exist - at least none that I know of. I'm just continuing the ancient I don't mind how it is done; the concept outlined by @eddyb is a bit foreign to me, but I wouldn't mind doing it that way with a little bit of mentoring. |
@nikomatsakis Mostly whatever happens to get a
Lines 50 to 83 in 0221e26
IMO "item-likes" is an outdated concept, but my preferred solution (i.e. consolidating a notion of "def" beyond just |
Ping from triage |
Ping from triage. @nikomatsakis any updates on this? Thanks. |
All I'm saying is reduce the "item-like" distinction further and make all things with a It's not a complex plan, and the only complications would be things that assume too much about |
☔ The latest upstream changes (presumably #65733) made this pull request unmergeable. Please resolve the merge conflicts. |
OK, @ljedrz -- so I talked some to @eddyb about this a few days back. I asked them if they'd be willing to mentor you through their preferred approach. They said yes, but they'd have to do a bit of exploratory refactoring first. The idea was that they would create a PR that points the direction and hand if off to you to fill in the details. I think they had the impression that this would be relatively quick but then again I think they're still working on it. =) I think my preferred outcome would be:
As I think I wrote somewhere, I would also like to see that plan written out as documentation -- it seems like we should be discussing how |
I'm ok with this 👍. |
Split out from #62975.
Introduce a
HirId
toDefIndex
map inmap::Definitions
; this introduces a little bit of extra complexity, but could result in a performance win. I'd do a perf run to check if it's worth it.