Separate definitions and HIR owners in the type system #83158
Labels
A-HIR
Area: The high-level intermediate representation (HIR)
E-help-wanted
Call for participation: Help is requested to fix this issue.
E-medium
Call for participation: Medium difficulty. Experience needed to fix: Intermediate.
E-mentor
Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Both definitions and HIR owners are represented by a LocalDefId,
but they don't have the same semantics.
HIR owners are the
owner
field of aHirId
,and the argument passed to the
hir_owner*
queries.HIR owners contain the following HIR nodes: Item, TraitItem, ImplItem, ForeignItem, MacroDef,
and
GenericParam
s which come fromimpl Trait
desugaring.LocalDefId enumerate definitions in the local crate.
Definitions are a broader concept than HIR owners.
For instance, closures are definitions but not HIR owners.
On the other hand, all HIR owners are definitions.
We need to introduce a new type
HirOwner
type (name to bikeshed),whose usage will be the following:
HirOwner
is defined asstruct HirOwner { def_id: LocalDefId }
;HirId
becomes{ owner: HirOwner, local_id: ItemLocalId }
;HirOwner
as theirdef_id
field;hir_owner*
queries take aHirOwner
as argument;HirOwner
andLocalDefId
happens throughthe
local_def_id_to_hir_id: LocalDefId -> HirId
and
local_def_id: HirId -> LocalDefId
methods.I am available on Zulip for further information.
The text was updated successfully, but these errors were encountered: