implement "lifetime juggling" methods from chalk integration trait #55097
Labels
A-trait-system
Area: Trait system
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
WG-traits
Working group: Traits, https://internals.rust-lang.org/t/announcing-traits-working-group/6804
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. TheLift
trait is defined in rustc. Therefore, the impl ofLift
forExClause
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 inlibrustc_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 ofLift
for theDelayedLiteral
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.The text was updated successfully, but these errors were encountered: