rustc_type_ir::lift

Trait Lift

Source
pub trait Lift<I>: Debug {
    type Lifted: Debug;

    // Required method
    fn lift_to_interner(self, cx: I) -> Option<Self::Lifted>;
}
Expand description

A trait implemented for all X<'a> types that can be safely and efficiently converted to X<'tcx> as long as they are part of the provided TyCtxt<'tcx>. This can be done, for example, for Ty<'tcx> or GenericArgsRef<'tcx> by looking them up in their respective interners.

However, this is still not the best implementation as it does need to compare the components, even for interned values. It would be more efficient if TypedArena provided a way to determine whether the address is in the allocated range.

None is returned if the value or one of the components is not part of the provided context. For Ty, None can be returned if either the type interner doesn’t contain the TyKind key or if the address of the interned pointer differs. The latter case is possible if a primitive type, e.g., () or u8, was interned in a different context.

Required Associated Types§

Required Methods§

Source

fn lift_to_interner(self, cx: I) -> Option<Self::Lifted>

Implementors§

Source§

impl<I> Lift<I> for BoundConstness

Source§

impl<I, J> Lift<J> for ExistentialPredicate<I>
where I: Interner, J: Interner, ExistentialTraitRef<I>: Lift<J, Lifted = ExistentialTraitRef<J>>, ExistentialProjection<I>: Lift<J, Lifted = ExistentialProjection<J>>, I::DefId: Lift<J, Lifted = J::DefId>,

Source§

impl<I, J> Lift<J> for CanonicalVarValues<I>
where I: Interner, J: Interner, I::GenericArgs: Lift<J, Lifted = J::GenericArgs>,

Source§

impl<I, J> Lift<J> for UnevaluatedConst<I>
where I: Interner, J: Interner, I::DefId: Lift<J, Lifted = J::DefId>, I::GenericArgs: Lift<J, Lifted = J::GenericArgs>,

Source§

impl<I, J> Lift<J> for AliasTerm<I>
where I: Interner, J: Interner, I::GenericArgs: Lift<J, Lifted = J::GenericArgs>, I::DefId: Lift<J, Lifted = J::DefId>, (): Lift<J, Lifted = ()>,

Source§

impl<I, J> Lift<J> for CoercePredicate<I>
where I: Interner, J: Interner, I::Ty: Lift<J, Lifted = J::Ty>,

Source§

impl<I, J> Lift<J> for ExistentialProjection<I>
where I: Interner, J: Interner, I::DefId: Lift<J, Lifted = J::DefId>, I::GenericArgs: Lift<J, Lifted = J::GenericArgs>, I::Term: Lift<J, Lifted = J::Term>, (): Lift<J, Lifted = ()>,

Source§

impl<I, J> Lift<J> for ExistentialTraitRef<I>
where I: Interner, J: Interner, I::DefId: Lift<J, Lifted = J::DefId>, I::GenericArgs: Lift<J, Lifted = J::GenericArgs>, (): Lift<J, Lifted = ()>,

Source§

impl<I, J> Lift<J> for HostEffectPredicate<I>
where I: Interner, J: Interner, TraitRef<I>: Lift<J, Lifted = TraitRef<J>>, HostPolarity: Lift<J, Lifted = HostPolarity>,

Source§

impl<I, J> Lift<J> for NormalizesTo<I>
where I: Interner, J: Interner, AliasTerm<I>: Lift<J, Lifted = AliasTerm<J>>, I::Term: Lift<J, Lifted = J::Term>,

Source§

impl<I, J> Lift<J> for ProjectionPredicate<I>
where I: Interner, J: Interner, AliasTerm<I>: Lift<J, Lifted = AliasTerm<J>>, I::Term: Lift<J, Lifted = J::Term>,

Source§

impl<I, J> Lift<J> for SubtypePredicate<I>
where I: Interner, J: Interner, bool: Lift<J, Lifted = bool>, I::Ty: Lift<J, Lifted = J::Ty>,

Source§

impl<I, J> Lift<J> for TraitPredicate<I>
where I: Interner, J: Interner, TraitRef<I>: Lift<J, Lifted = TraitRef<J>>, PredicatePolarity: Lift<J, Lifted = PredicatePolarity>,

Source§

impl<I, J> Lift<J> for TraitRef<I>
where I: Interner, J: Interner, I::DefId: Lift<J, Lifted = J::DefId>, I::GenericArgs: Lift<J, Lifted = J::GenericArgs>, (): Lift<J, Lifted = ()>,

Source§

impl<I, J> Lift<J> for ClosureArgs<I>
where I: Interner, J: Interner, I::GenericArgs: Lift<J, Lifted = J::GenericArgs>,

Source§

impl<I, J> Lift<J> for CoroutineArgs<I>
where I: Interner, J: Interner, I::GenericArgs: Lift<J, Lifted = J::GenericArgs>,

Source§

impl<I, J> Lift<J> for CoroutineClosureArgs<I>
where I: Interner, J: Interner, I::GenericArgs: Lift<J, Lifted = J::GenericArgs>,

Source§

impl<I, J> Lift<J> for AliasTy<I>
where I: Interner, J: Interner, I::GenericArgs: Lift<J, Lifted = J::GenericArgs>, I::DefId: Lift<J, Lifted = J::DefId>, (): Lift<J, Lifted = ()>,

Source§

impl<I, J> Lift<J> for FnHeader<I>
where I: Interner, J: Interner, bool: Lift<J, Lifted = bool>, I::Safety: Lift<J, Lifted = J::Safety>, I::Abi: Lift<J, Lifted = J::Abi>,

Source§

impl<I, J> Lift<J> for FnSig<I>
where I: Interner, J: Interner, I::Tys: Lift<J, Lifted = J::Tys>, bool: Lift<J, Lifted = bool>, I::Safety: Lift<J, Lifted = J::Safety>, I::Abi: Lift<J, Lifted = J::Abi>,

Source§

impl<I, J> Lift<J> for FnSigTys<I>
where I: Interner, J: Interner, I::Tys: Lift<J, Lifted = J::Tys>,

Source§

impl<I, P, J> Lift<J> for Goal<I, P>
where I: Interner, J: Interner, I::ParamEnv: Lift<J, Lifted = J::ParamEnv>, P: Lift<J, Lifted = P>,

Source§

type Lifted = Goal<J, P>

Source§

impl<I: Interner, U: Interner, A> Lift<U> for OutlivesPredicate<I, A>
where A: Lift<U>, I::Region: Lift<U, Lifted = U::Region>,

Source§

impl<I: Interner, U: Interner, T> Lift<U> for Binder<I, T>
where T: Lift<U>, I::BoundVarKinds: Lift<U, Lifted = U::BoundVarKinds>,

Source§

type Lifted = Binder<U, <T as Lift<U>>::Lifted>

impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for &'a List<BoundVariableKind>

impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for &'a List<GenericArg<'a>>

impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for &'a List<Ty<'a>>

impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for &'a List<PolyExistentialPredicate<'a>>

impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for &'a [ValTree<'a>]

impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for ConstAllocation<'a>

impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for Const<'a>

impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for GenericArg<'a>

impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for Pattern<'a>

impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for Clause<'a>

impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for Predicate<'a>

impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for Region<'a>

impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for Term<'a>

impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for Ty<'a>

impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for Layout<'a>

impl<'tcx> Lift<TyCtxt<'tcx>> for Abi

impl<'tcx> Lift<TyCtxt<'tcx>> for Scalar

impl<'tcx> Lift<TyCtxt<'tcx>> for IsConstable

impl<'tcx> Lift<TyCtxt<'tcx>> for ClosureKind

impl<'tcx> Lift<TyCtxt<'tcx>> for HostPolarity

impl<'tcx> Lift<TyCtxt<'tcx>> for ImplPolarity

impl<'tcx> Lift<TyCtxt<'tcx>> for PredicatePolarity

impl<'tcx> Lift<TyCtxt<'tcx>> for ReifyReason

impl<'tcx> Lift<TyCtxt<'tcx>> for bool

impl<'tcx> Lift<TyCtxt<'tcx>> for u64

impl<'tcx> Lift<TyCtxt<'tcx>> for ()

impl<'tcx> Lift<TyCtxt<'tcx>> for usize

impl<'tcx> Lift<TyCtxt<'tcx>> for DefId

impl<'tcx> Lift<TyCtxt<'tcx>> for CtfeProvenance

impl<'tcx> Lift<TyCtxt<'tcx>> for AllocId

impl<'tcx> Lift<TyCtxt<'tcx>> for Promoted

impl<'tcx> Lift<TyCtxt<'tcx>> for ParamConst

impl<'tcx> Lift<TyCtxt<'tcx>> for ParamTy

impl<'tcx> Lift<TyCtxt<'tcx>> for Safety

impl<'tcx> Lift<TyCtxt<'tcx>> for Size

impl<'tcx, '__lifted> Lift<TyCtxt<'__lifted>> for Const<'tcx>

impl<'tcx, '__lifted> Lift<TyCtxt<'__lifted>> for ConstValue<'tcx>

impl<'tcx, '__lifted> Lift<TyCtxt<'__lifted>> for InstanceKind<'tcx>

impl<'tcx, '__lifted> Lift<TyCtxt<'__lifted>> for UnevaluatedConst<'tcx>

impl<'tcx, '__lifted> Lift<TyCtxt<'__lifted>> for Instance<'tcx>

impl<'tcx, '__lifted> Lift<TyCtxt<'__lifted>> for PrintClosureAsImpl<'tcx>

impl<'tcx, '__lifted> Lift<TyCtxt<'__lifted>> for TraitPredPrintModifiersAndPath<'tcx>

impl<'tcx, '__lifted> Lift<TyCtxt<'__lifted>> for TraitPredPrintWithBoundConstness<'tcx>

impl<'tcx, '__lifted> Lift<TyCtxt<'__lifted>> for TraitRefPrintOnlyTraitName<'tcx>

impl<'tcx, '__lifted> Lift<TyCtxt<'__lifted>> for TraitRefPrintOnlyTraitPath<'tcx>

impl<'tcx, '__lifted> Lift<TyCtxt<'__lifted>> for TraitRefPrintSugared<'tcx>

impl<'tcx, T: Lift<TyCtxt<'tcx>>> Lift<TyCtxt<'tcx>> for Option<T>

impl<I, J> Lift<J> for NestedGoals<I>
where I: Interner, J: Interner, Vec<Goal<I, NormalizesTo<I>>>: Lift<J, Lifted = Vec<Goal<J, NormalizesTo<J>>>>, Vec<(GoalSource, Goal<I, I::Predicate>)>: Lift<J, Lifted = Vec<(GoalSource, Goal<J, J::Predicate>)>>,