-
Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Labels
E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.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.
Description
Functions, constants and statics have an associated hir::Body and are known as body owners. Typechecking and MIR generation work by iterating over all the body owners in the crate. This iteration traverses the full HIR.
The objective is to avoid repeated traversal of the full HIR by reusing the traversal done by hir_module_items and hir_crate_items query. The secondary objective is to reduce the number of queries that directly depend on the full HIR query (hir_crate).
Instructions:
- create a
body_owners: Box<[LocalDefId]>field inrustc_middle::hir::ModuleItems; - fill
body_ownersin the two queries' visitors; - use
hir_crate_items(()).body_ownersintcx.hir().{,par_}body_ownersinstead of iterating ontcx.hir().krate().
The following steps are a possible cleanup to avoid a few back-and-forth conversions between LocalDefId and HirId:
- refactor
tcx.hir().{,maybe_}body_owned_byto take aLocalDefIdas a parameter; - refactor
tcx.hir().enclosing_body_ownerto return aLocalDefId.
Metadata
Metadata
Assignees
Labels
E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.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.