Trait rustc_middle::ty::lift::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§

source§

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

source§

type Lifted = &'tcx [ValTree<'tcx>]

source§

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

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 Safety

source§

type Lifted = Safety

source§

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

source§

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

source§

type Lifted = Abi

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

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

source§

impl<'a, 'tcx> Lift<TyCtxt<'tcx>> for rustc_middle::ty::consts::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 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 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<'tcx> Lift<TyCtxt<'tcx>> for Scalar

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

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, '__lifted> Lift<TyCtxt<'__lifted>> for rustc_middle::mir::consts::Const<'tcx>

source§

type Lifted = Const<'__lifted>

source§

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

source§

type Lifted = ConstValue<'__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::consts::UnevaluatedConst<'tcx>

source§

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

source§

type Lifted = Instance<'__lifted>

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 TraitRefPrintOnlyTraitName<'tcx>

source§

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

source§

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

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

source§

impl<I, J> Lift<J> for rustc_type_ir::const_kind::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>,

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

source§

impl<I, J> Lift<J> for ExistentialTraitRef<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>,

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

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