Lift

Trait Lift 

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§

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

Implementations on Foreign Types§

Source§

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

Source§

type Lifted = Layout<'tcx>

Source§

fn lift_to_interner(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted>

Source§

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

Source§

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

Source§

type Lifted = Safety

Source§

fn lift_to_interner(self, _: TyCtxt<'tcx>) -> Option<Self>

Source§

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

Source§

type Lifted = bool

Source§

fn lift_to_interner(self, _: TyCtxt<'tcx>) -> Option<Self>

Source§

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

Source§

type Lifted = u64

Source§

fn lift_to_interner(self, _: TyCtxt<'tcx>) -> Option<Self>

Source§

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

Source§

type Lifted = ()

Source§

fn lift_to_interner(self, _: TyCtxt<'tcx>) -> Option<Self>

Source§

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

Source§

type Lifted = usize

Source§

fn lift_to_interner(self, _: TyCtxt<'tcx>) -> Option<Self>

Source§

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

Source§

type Lifted = Size

Source§

fn lift_to_interner(self, _: TyCtxt<'tcx>) -> Option<Self>

Source§

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

Source§

type Lifted = PhantomData<&'tcx ()>

Source§

fn lift_to_interner(self, _: TyCtxt<'tcx>) -> Option<Self::Lifted>

Source§

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

Source§

type Lifted = DefId

Source§

fn lift_to_interner(self, _: TyCtxt<'tcx>) -> Option<Self>

Source§

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

Source§

type Lifted = Option<<T as Lift<TyCtxt<'tcx>>>::Lifted>

Source§

fn lift_to_interner(self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted>

Implementors§

Source§

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

Source§

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

Source§

type Lifted = &'tcx RawList<(), GenericArg<'tcx>>

Source§

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

Source§

type Lifted = &'tcx RawList<(), Ty<'tcx>>

Source§

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

Source§

type Lifted = &'tcx RawList<(), Binder<TyCtxt<'tcx>, ExistentialPredicate<TyCtxt<'tcx>>>>

Source§

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

Source§

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

Source§

type Lifted = Pattern<'tcx>

Source§

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

Source§

type Lifted = Clause<'tcx>

Source§

impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for rustc_middle::ty::Const<'a>

Source§

type Lifted = Const<'tcx>

Source§

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

Source§

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

Source§

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

Source§

type Lifted = Region<'tcx>

Source§

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

Source§

type Lifted = Term<'tcx>

Source§

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

Source§

type Lifted = Ty<'tcx>

Source§

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

Source§

type Lifted = ValTree<'tcx>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

impl<'tcx, '__lifted> Lift<TyCtxt<'__lifted>> for rustc_middle::mir::Const<'tcx>

Source§

type Lifted = Const<'__lifted>

Source§

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

Source§

type Lifted = InstanceKind<'__lifted>

Source§

impl<'tcx, '__lifted> Lift<TyCtxt<'__lifted>> for rustc_middle::mir::UnevaluatedConst<'tcx>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

type Lifted = Instance<'__lifted>

Source§

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

Source§

type Lifted = Value<'__lifted>

§

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

§

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

§

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

§

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

§

impl<I, J> Lift<J> for CoroutineWitnessTypes<I>
where I: Interner, J: Interner, <I as Interner>::Tys: Lift<J, Lifted = <J as Interner>::Tys>, <I as Interner>::RegionAssumptions: Lift<J, Lifted = <J as Interner>::RegionAssumptions>,

§

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

§

type Lifted = FnHeader<J>

§

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

§

type Lifted = FnSigTys<J>

§

impl<I, J> Lift<J> for UnsafeBinderInner<I>
where I: Interner, J: Interner, Binder<I, <I as Interner>::Ty>: Lift<J, Lifted = Binder<J, <J as Interner>::Ty>>,

§

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

§

type Lifted = AliasTerm<J>

§

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

§

type Lifted = AliasTy<J>

§

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

§

type Lifted = CoercePredicate<J>

§

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 as Interner>::TraitId: Lift<J, Lifted = <J as Interner>::TraitId>,

§

type Lifted = ExistentialPredicate<J>

§

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

§

type Lifted = ExistentialProjection<J>

§

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

§

type Lifted = ExistentialTraitRef<J>

§

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

§

type Lifted = FnSig<J>

§

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

§

type Lifted = HostEffectPredicate<J>

§

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

§

type Lifted = NormalizesTo<J>

§

impl<I, J> Lift<J> for PatternKind<I>
where I: Interner, J: Interner, <I as Interner>::Const: Lift<J, Lifted = <J as Interner>::Const>, <I as Interner>::PatList: Lift<J, Lifted = <J as Interner>::PatList>,

§

type Lifted = PatternKind<J>

§

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

§

type Lifted = ProjectionPredicate<J>

§

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

§

type Lifted = SubtypePredicate<J>

§

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>,

§

type Lifted = TraitPredicate<J>

§

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

§

type Lifted = TraitRef<J>

§

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

§

type Lifted = UnevaluatedConst<J>

§

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

§

type Lifted = Goal<J, P>

§

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

§

type Lifted = OutlivesPredicate<U, <A as Lift<U>>::Lifted>

§

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

§

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