-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Separate definitions and HIR owners in the type system #83158
Copy link
Copy link
Closed
Labels
A-HIRArea: The high-level intermediate representation (HIR)Area: The high-level intermediate representation (HIR)E-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.Call for participation: Medium difficulty. Experience needed to fix: Intermediate.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.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)E-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.Call for participation: Medium difficulty. Experience needed to fix: Intermediate.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.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.
Both definitions and HIR owners are represented by a LocalDefId,
but they don't have the same semantics.
HIR owners are the
ownerfield of aHirId,and the argument passed to the
hir_owner*queries.HIR owners contain the following HIR nodes: Item, TraitItem, ImplItem, ForeignItem, MacroDef,
and
GenericParams which come fromimpl Traitdesugaring.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
HirOwnertype (name to bikeshed),whose usage will be the following:
HirOwneris defined asstruct HirOwner { def_id: LocalDefId };HirIdbecomes{ owner: HirOwner, local_id: ItemLocalId };HirOwneras theirdef_idfield;hir_owner*queries take aHirOwneras argument;HirOwnerandLocalDefIdhappens throughthe
local_def_id_to_hir_id: LocalDefId -> HirIdand
local_def_id: HirId -> LocalDefIdmethods.I am available on Zulip for further information.