You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This proposes allowing crates downstream of rustc_middle to define their own queries. The crates defining queries still have to be upstream from rustc_interface.
This is useful as we can then define queries on types unavailable in rustc_middle or move types currently forced to be in rustc_middle to an appropriate location.
Crates will have a queries module listing queries, which uses macros to defined needed code like the current rustc_middle::queries.
Accessing queries will be done with an extension trait, so to use rustc_borrowck's queries you'd import rustc_borrowck::Queries, then you'd be able to call them on tcx.
Each crate defining queries will need their own state for the query system to use, so GlobalCtxt will have a rustc_borrowck: &'tcx dyn Any<'tcx> field per such crate (with some unsafe to make 'tcx work). That allows access to that state from TyCtxt. The state can be owned by rustc_interface.
Proposal
This proposes allowing crates downstream of
rustc_middleto define their own queries. The crates defining queries still have to be upstream fromrustc_interface.This is useful as we can then define queries on types unavailable in
rustc_middleor move types currently forced to be inrustc_middleto an appropriate location.Crates will have a
queriesmodule listing queries, which uses macros to defined needed code like the currentrustc_middle::queries.Accessing queries will be done with an extension trait, so to use
rustc_borrowck's queries you'd importrustc_borrowck::Queries, then you'd be able to call them ontcx.Each crate defining queries will need their own state for the query system to use, so
GlobalCtxtwill have arustc_borrowck: &'tcx dyn Any<'tcx>field per such crate (with some unsafe to make'tcxwork). That allows access to that state fromTyCtxt. The state can be owned byrustc_interface.Mentors or Reviewers
Process
The main points of the Major Change Process are as follows:
@rustbot secondor kickoff a team FCP with@rfcbot fcp $RESOLUTION.You can read more about Major Change Proposals on forge.
Caution
Concerns (2 active)
Managed by
@rustbot—see help for details.