-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Simplify resolve_lifetimes #57408
Simplify resolve_lifetimes #57408
Conversation
This comment has been minimized.
This comment has been minimized.
36cadcb
to
0aafea8
Compare
0aafea8
to
a82a741
Compare
@@ -538,6 +539,7 @@ pub enum GenericParamKind { | |||
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] | |||
pub struct GenericParam { | |||
pub id: NodeId, |
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.
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
?
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 have, and there were quite a few. I can try giving it a shot 👍.
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.
@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.
Do you think the extra memory required to hold |
FWIW, in the meantime I'm trying to go HARD (the only way possible tbh) on |
Closing in favor of #57578. |
Obtaining
hir_id
is free during lowering, so I thought it might be a good idea to save it while creatinghir::Lifetime
andhir::GenericParam
so thatresolve_lifetimes
can do less work.I'm pretty sure
resolve_lifetimes
can be simplified further (I'd like to squashNamedRegionMap
withResolveLifetimes
), 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