Skip to main content

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>

Implementations on Foreign Types§

§

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

§

type Lifted = Layout<'tcx>

§

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

§

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

§

type Lifted = Clause<'tcx>

§

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

§

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

§

type Lifted = Const<'tcx>

§

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

§

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

§

type Lifted = ConstAllocation<'tcx>

§

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

§

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

§

type Lifted = GenericArg<'tcx>

§

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

§

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

§

type Lifted = Pattern<'tcx>

§

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

§

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

§

type Lifted = Predicate<'tcx>

§

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

§

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

§

type Lifted = Region<'tcx>

§

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

§

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

§

type Lifted = Term<'tcx>

§

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

§

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

§

type Lifted = Ty<'tcx>

§

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

§

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

§

type Lifted = ValTree<'tcx>

§

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

§

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

§

type Lifted = ExternAbi

§

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

§

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

§

type Lifted = Safety

§

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

§

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

§

type Lifted = bool

§

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

§

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

§

type Lifted = u64

§

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

§

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

§

type Lifted = ()

§

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

§

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

§

type Lifted = usize

§

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

§

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

§

type Lifted = Size

§

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

§

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

§

type Lifted = DefId

§

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

§

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

§

type Lifted = PhantomData<&'tcx ()>

§

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

§

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

§

type Lifted = AllocId

§

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

§

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

§

type Lifted = ConstValue

§

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

§

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

§

type Lifted = ParamConst

§

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

§

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

§

type Lifted = ParamTy

§

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

§

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

§

type Lifted = Promoted

§

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

§

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

§

type Lifted = ReifyReason

§

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

§

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

§

type Lifted = RuntimeChecks

§

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

§

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

§

type Lifted = Scalar

§

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

§

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

§

type Lifted = Const<'__lifted>

§

fn lift_to_interner(self, __tcx: TyCtxt<'__lifted>) -> Option<Const<'__lifted>>

§

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

§

type Lifted = Instance<'__lifted>

§

fn lift_to_interner( self, __tcx: TyCtxt<'__lifted>, ) -> Option<Instance<'__lifted>>

§

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

§

type Lifted = InstanceKind<'__lifted>

§

fn lift_to_interner( self, __tcx: TyCtxt<'__lifted>, ) -> Option<InstanceKind<'__lifted>>

§

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

§

type Lifted = PrintClosureAsImpl<'__lifted>

§

fn lift_to_interner( self, __tcx: TyCtxt<'__lifted>, ) -> Option<PrintClosureAsImpl<'__lifted>>

§

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

§

type Lifted = TraitPredPrintModifiersAndPath<'__lifted>

§

fn lift_to_interner( self, __tcx: TyCtxt<'__lifted>, ) -> Option<TraitPredPrintModifiersAndPath<'__lifted>>

§

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

§

type Lifted = TraitPredPrintWithBoundConstness<'__lifted>

§

fn lift_to_interner( self, __tcx: TyCtxt<'__lifted>, ) -> Option<TraitPredPrintWithBoundConstness<'__lifted>>

§

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

§

type Lifted = TraitRefPrintOnlyTraitName<'__lifted>

§

fn lift_to_interner( self, __tcx: TyCtxt<'__lifted>, ) -> Option<TraitRefPrintOnlyTraitName<'__lifted>>

§

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

§

type Lifted = TraitRefPrintOnlyTraitPath<'__lifted>

§

fn lift_to_interner( self, __tcx: TyCtxt<'__lifted>, ) -> Option<TraitRefPrintOnlyTraitPath<'__lifted>>

§

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

§

type Lifted = TraitRefPrintSugared<'__lifted>

§

fn lift_to_interner( self, __tcx: TyCtxt<'__lifted>, ) -> Option<TraitRefPrintSugared<'__lifted>>

§

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

§

type Lifted = UnevaluatedConst<'__lifted>

§

fn lift_to_interner( self, __tcx: TyCtxt<'__lifted>, ) -> Option<UnevaluatedConst<'__lifted>>

§

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

§

type Lifted = Value<'__lifted>

§

fn lift_to_interner(self, __tcx: TyCtxt<'__lifted>) -> Option<Value<'__lifted>>

§

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

§

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

§

fn lift_to_interner( self, tcx: TyCtxt<'tcx>, ) -> Option<Option<<T as Lift<TyCtxt<'tcx>>>::Lifted>>

Implementors§

§

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

§

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

Source§

impl<I, J> Lift<J> for BoundRegionKind<I>
where I: Interner, J: Interner, <I as Interner>::Symbol: Lift<J, Lifted = <J as Interner>::Symbol>, <I as Interner>::DefId: Lift<J, Lifted = <J as Interner>::DefId>,

Source§

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

Source§

impl<I, J> Lift<J> for BoundVariableKind<I>
where I: Interner, J: Interner, BoundTyKind<I>: Lift<J, Lifted = BoundTyKind<J>>, BoundRegionKind<I>: Lift<J, Lifted = BoundRegionKind<J>>,

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

Source§

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

Source§

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 = ()>,

Source§

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 = ()>,

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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 = ()>,

Source§

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 = ()>,

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

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

Source§

impl<I, J> Lift<J> for rustc_trait_selection::infer::canonical::ir::UnevaluatedConst<I>
where I: Interner, J: Interner, <I as Interner>::UnevaluatedConstId: Lift<J, Lifted = <J as Interner>::UnevaluatedConstId>, <I as Interner>::GenericArgs: Lift<J, Lifted = <J as Interner>::GenericArgs>,

Source§

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

Source§

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

Source§

type Lifted = Goal<J, P>

Source§

impl<I, U> Lift<U> for BoundTy<I>
where I: Interner, U: Interner, BoundTyKind<I>: Lift<U, Lifted = BoundTyKind<U>>,

Source§

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

Source§

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

Source§

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

Source§

impl<I, U, T> Lift<U> for Placeholder<I, T>
where I: Interner, U: Interner, T: Lift<U>,

Source§

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