Description
The chalk integration trait includes a few methods whose job is to do "lifetime juggling", in terms of converting values between the "type inference" arena lifetime ('tcx
) and the "global arena" lifetime ('gcx
) (see the rustc guide for more details about these lifetimes, if you are not familiar with them).
Case 1 is the LiftExClause
trait:
rust/src/librustc_traits/chalk_context.rs
Lines 473 to 482 in 4f9b581
This trait exists for coherence reasons -- on the one hand, the ExClause
type is defined in chalk. The Lift
trait is defined in rustc. Therefore, the impl of Lift
for ExClause
has to be in librustc -- but librustc doesn't know enough to do the implementation. So we add an auxiliary trait that is implemented over in librustc_traits
. And this is the impl!
We need to implement the fn body here. It's probably just a matter of invoking tcx.lift_to_global
, but I'm not sure.
For this case, we probably just need to invoke tcx.lift_to_global(value)
-- but we may need to add some impls of Lift
for the DelayedLiteral
type.
Case 2 is the lift_delayed_literal
method:
rust/src/librustc_traits/chalk_context.rs
Lines 445 to 450 in 4f9b581
This probably needs an "auxiliary" trait like LiftExClause
above, for the same reason.