refactor the AssociatedItem
structures
#40697
Labels
A-associated-items
Area: Associated items (types, constants & functions)
C-cleanup
Category: PRs that clean code up or issues documenting cleanup.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
During the work on #40668, there was some discussion about refactoring the
ty::AssociatedItem
andhir::{Impl,Trait}ItemRef
data structures. The precise plan is a bit unclear, so I'm opening this issue to try and discuss and lay it out.Observations:
ty::AssociatedItem
lives inty
, it has no real dependencies and is based entirely on the HIR, so it would better live in HIR.ImplItemRef
andTraitItemRef
are basically specialized variants ofAssociatedItem
, though they add aSpan
and use local-ids (ImplItemId
) rather than aDefId
.DefId
gives you back theAssociatedItem
(including across crates). The local-crate portion of this query seems like it could live inhir::map
quite 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 aboutX
to have to change whenX
changes).cc @eddyb @cramertj
The text was updated successfully, but these errors were encountered: