-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
refactor the AssociatedItem structures #40697
Copy link
Copy link
Open
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)C-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-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)C-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.
During the work on #40668, there was some discussion about refactoring the
ty::AssociatedItemandhir::{Impl,Trait}ItemRefdata structures. The precise plan is a bit unclear, so I'm opening this issue to try and discuss and lay it out.Observations:
ty::AssociatedItemlives inty, it has no real dependencies and is based entirely on the HIR, so it would better live in HIR.ImplItemRefandTraitItemRefare basically specialized variants ofAssociatedItem, though they add aSpanand use local-ids (ImplItemId) rather than aDefId.DefIdgives you back theAssociatedItem(including across crates). The local-crate portion of this query seems like it could live inhir::mapquite nicely.Hir(X)when computingAssociatedItem(X), instead reading from the containing impl/trait; this is because we don't want to require everything that needed even basic information aboutXto have to change whenXchanges).cc @eddyb @cramertj