Skip to content

Conversation

ljedrz
Copy link
Contributor

@ljedrz ljedrz commented Jan 7, 2019

Obtaining hir_id is free during lowering, so I thought it might be a good idea to save it while creating hir::Lifetime and hir::GenericParam so that resolve_lifetimes can do less work.

I'm pretty sure resolve_lifetimes can be simplified further (I'd like to squash NamedRegionMap with ResolveLifetimes), but I need to sleep on it; this seems like a step in the right direction.

As an added bonus this should be a step forward for #50928.

r? @varkor

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 7, 2019
@rust-highfive

This comment has been minimized.

@ljedrz ljedrz force-pushed the simplify_resolve_lifetimes branch from 36cadcb to 0aafea8 Compare January 7, 2019 19:46
@ljedrz ljedrz force-pushed the simplify_resolve_lifetimes branch from 0aafea8 to a82a741 Compare January 8, 2019 16:50

#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
pub struct GenericParam {
pub id: NodeId,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid having NodeId at all? Then this would be a clear win. Have you looked at the remaining uses of id for GenericParam and Lifetime?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have, and there were quite a few. I can try giving it a shot 👍.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@varkor Actually this is super complex; NodeId is still used in lots of places and just removing it causes lots of breakage, making it hard to debug. I can see that most Hir objects still point to NodeId, probably for the same reason. I have a suggestion: I will try to migrate methods working on NodeId to HirId in following PRs; at one point the compiler should just tell us that the NodeId field is not used anymore - that approach should be a lot cleaner.

@ljedrz
Copy link
Contributor Author

ljedrz commented Jan 9, 2019

Do you think the extra memory required to hold hir_id would be noticeable in the perf? Maybe it's not a big deal; otherwise, of course, some other way of cracking this would be advisable.

@ljedrz
Copy link
Contributor Author

ljedrz commented Jan 11, 2019

FWIW, in the meantime I'm trying to go HARD (the only way possible tbh) on HirIdification; if I succeed, most of the NodeIds in Hir items should become obsolete.

@ljedrz
Copy link
Contributor Author

ljedrz commented Jan 13, 2019

Closing in favor of #57578.

@ljedrz ljedrz closed this Jan 13, 2019
@ljedrz ljedrz deleted the simplify_resolve_lifetimes branch March 9, 2019 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants