fix: derive source scope from syntax node to be transformed by lowr · Pull Reque...
source link: https://github.com/rust-lang/rust-analyzer/pull/14989
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Conversation
Contributor
Fixes #14534
When we use PathTransform
for associated items of a trait, we have been feeding SemanticsScope
for the trait definition to it as source scope. PathTransform
uses the source scope to resolve paths in associated items to find which path to transform. In the course of path resolution, the scope is responsible for lowering ast::MacroType
s (because they can be written within a path) using AstIdMap
for the scope's HirFileId
.
The problem here is that when an associated item is generated by a macro, the scope for the trait is different from the scope for that associated item. The former can only resolve the top-level macros within the trait definition but not the macro calls generated by those top-level macros. We need the latter to resolve such nested macros.
This PR makes sure that we pass SemanticsScope
for each associated item we're applying path transformation to.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK