-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🛠 introduce abstraction layer between trait solver and type checker #48895
Comments
Mentoring instructions (part 1)How it works todayThe main interaction that the type checker has with the fulfillment context is to "register" obligations with it and try to solve them. Registering is primarily done with this method: rust/src/librustc/traits/fulfill.rs Lines 147 to 149 in fedce67
Solving is done with rust/src/librustc/traits/fulfill.rs Lines 193 to 195 in fedce67
And rust/src/librustc/traits/fulfill.rs Lines 175 to 177 in fedce67
Step 1: Introduce
|
fulfillment_cx: RefCell<traits::FulfillmentContext<'tcx>>, |
There may be other uses of FulfillmentContext
within librustc_typeck
, you can ripgrep around. We should be able to convert them all.
Step 2: Add compiler flag and alternative implementation
I'll leave this step for later. =)
cc @rust-lang/wg-traits -- this is the refactoring step that will allow us to introduce |
This is the sort of structural change that is right up my alley (but I also have a non-zero number of things already on my plate so if someone else is looking for a thing to do, go for it) |
This work looks not so hard for a rustlang newbie from the mentoring instructions up to now. If I didn’t underestimate the difficulty, please consider me for this. |
@csmoe How goes? Have you had a chance to take a look at this yet? It would be very useful. =) |
@nikomatsakis I have done mostly, but stuck at the lifetime errors. |
Introduce trait engine address #48895 step 1: introduce trait engine
This is basically done enough for now I think |
The purpose of this issue is to setup a trait-solving structure that can change between the current trait solver and the type checker, allowing for us to easily switch to the chalk-style solving when a command line flag is given.
Currently, the interface between the two is the
FulfillmentContext
, so we have a relationship like this:The first phase then is to introduce another layer in between, let's call it the
TraitEngine
:When we're done with this phase, everything should work exactly the same, but that the type checker never interacts directly with the fulfillment context.
The text was updated successfully, but these errors were encountered: