-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Preallocate DefIds for lang items and use lang items in lowering #60607
Copy link
Copy link
Closed
Labels
A-HIRArea: The high-level intermediate representation (HIR)Area: The high-level intermediate representation (HIR)A-lang-itemArea: Language itemsArea: Language itemsC-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-HIRArea: The high-level intermediate representation (HIR)Area: The high-level intermediate representation (HIR)A-lang-itemArea: Language itemsArea: Language itemsC-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Right now, our lowering code uses string-paths to call e.g.
Iterator::nextwhen loweringforloops:rust/src/librustc/hir/lowering.rs
Lines 4653 to 4655 in c6ac575
This triggers a name resolution call
rust/src/librustc/hir/lowering.rs
Lines 5263 to 5273 in c6ac575
which will then give us a resolved path, but that's
?andforexpansions/lowerings)I think it would be neat if we could instead create the
lang_itemstable early in the process and just grab the appropriate item out of that table.cc @Centril @eddyb @petrochenkov
As a first experiment to check out the impact we could create a cache for path resolutions so we only run the path resolution code once and just overwrite all
HirIds in the generated path with newHirIds whenever we fetch a cached resolution.