Make AST->HIR lowering incremental #452
Labels
major-change
A proposal to make a major change to rustc
major-change-accepted
A major change proposal that was accepted
T-compiler
Add this label so rfcbot knows to poll the compiler team
Proposal
AST->HIR lowering is currently done ahead of the construction of the incremental compilation engine. This issue proposes to make lowering incremental by introducing a query
lower_to_hir(def: LocalDefId) -> Option<&hir::OwnerInfo<'_>>
which lowers the AST item corresponding to definitiondef
into the corresponding HIR and some associated information.The objective is to eventually skip lowering some parts of the AST, and to allow progress towards making resolution and expansion incremental.
The proposed design is as follows:
hir::Crate
, effectively makinghir::Crate
anIndexVec<LocalDefId, Option<OwnerInfo<'_>>>
;IndexVec<LocalDefId, AstOwner>
whereAstOwner
is an enum holdingOwningRef<Lrc<Crate>, ItemLike>
for differentItemLike
;One of the most subtle changes is (*), which allows to create new definitions from inside queries. It is made safe using an eval-always query which forces re-execution of its caller, and effectively enforces the side-effects creating the definition. The first time definitions are iterated over (for instance for metadata output), a read-lock to the definitions is leaked, which seals the list of definitions.
Draft branch is accessible at rust-lang/rust@master...cjgillot:lower-incr
Mentors or Reviewers
Process
The main points of the Major Change Process are as follows:
@rustbot second
.-C flag
, then full team check-off is required.@rfcbot fcp merge
on either the MCP or the PR.You can read more about Major Change Proposals on forge.
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.
The text was updated successfully, but these errors were encountered: