-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix: Resolve $crate
in derive paths
#14610
Conversation
d6f184a
to
cf72b62
Compare
@@ -1223,8 +1225,9 @@ impl DefCollector<'_> { | |||
} | |||
}; | |||
let ast_id = ast_id.with_value(ast_adt_id); | |||
let hygiene = Hygiene::new(self.db.upcast(), file_id); |
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.
(Haven't checked) I feel like we should have a hygiene lying around here somewhere already no? (Building hygiene isn't the cheapest from what I remember)
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.
All paths but those in attributes seem to be lowered during ItemTree
construction, which is decoupled from DefCollector
, so there's no Hygiene
around here. Moreover, a single DefCollector
operates on possibly multiple HirFileId
s, so we can't just cache Hygiene
in it.
One thing we could try is having something like HashMap<HirFileId, Hygiene>
in DefCollector
and building Hygiene
on demand. How does that sound?
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.
Ye I think adding that to reuse hygienes sounds good for now
@bors r+ |
$crate
in derive paths$crate
in derive paths
☀️ Test successful - checks-actions |
Paths in derive meta item list may contain any kind of paths, including those that start with
$crate
generated by macros. We need to take hygiene into account when we lower paths in the list.This issue was identified while investigating #14607, though this patch doesn't fix the broken trait resolution.