Trait rustc_middle::ty::Lift

source ·
pub trait Lift<'tcx>: Debug {
    type Lifted: Debug + 'tcx;

    // Required method
    fn lift_to_tcx(self, tcx: TyCtxt<'tcx>) -> 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§

source

type Lifted: Debug + 'tcx

Required Methods§

source

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

Implementations on Foreign Types§

source§

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

§

type Lifted = Size

source§

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

source§

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

§

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

source§

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

source§

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

§

type Lifted = Abi

source§

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

source§

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

§

type Lifted = DefId

source§

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

source§

impl<'tcx> Lift<'tcx> for Unsafety

§

type Lifted = Unsafety

source§

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

source§

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

§

type Lifted = ()

source§

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

source§

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

§

type Lifted = usize

source§

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

source§

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

§

type Lifted = bool

source§

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

source§

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

§

type Lifted = u64

source§

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

Implementors§

source§

impl<'__lifted, A, B> Lift<'__lifted> for OutlivesPredicate<A, B>where A: Lift<'__lifted>, B: Lift<'__lifted>,

§

type Lifted = OutlivesPredicate<<A as Lift<'__lifted>>::Lifted, <B as Lift<'__lifted>>::Lifted>

source§

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

source§

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

§

type Lifted = &'tcx List<GenericArg<'tcx>>

source§

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

§

type Lifted = &'tcx List<Ty<'tcx>>

source§

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

§

type Lifted = &'tcx List<Binder<'tcx, ExistentialPredicate<'tcx>>>

source§

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

source§

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

§

type Lifted = Const<'tcx>

source§

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

§

type Lifted = GenericArg<'tcx>

source§

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

§

type Lifted = Clause<'tcx>

source§

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

§

type Lifted = Predicate<'tcx>

source§

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

§

type Lifted = Term<'tcx>

source§

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

§

type Lifted = Ty<'tcx>

source§

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

§

type Lifted = Region<'tcx>

source§

impl<'tcx> Lift<'tcx> for Mutability

source§

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

source§

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

source§

impl<'tcx> Lift<'tcx> for AliasRelationDirection

source§

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

source§

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

source§

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

source§

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

source§

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

§

type Lifted = ConstValue<'__lifted>

source§

impl<'tcx, '__lifted> Lift<'__lifted> for ClauseKind<'tcx>

§

type Lifted = ClauseKind<'__lifted>

source§

impl<'tcx, '__lifted> Lift<'__lifted> for PredicateKind<'tcx>

§

type Lifted = PredicateKind<'__lifted>

source§

impl<'tcx, '__lifted> Lift<'__lifted> for InstanceDef<'tcx>

§

type Lifted = InstanceDef<'__lifted>

source§

impl<'tcx, '__lifted> Lift<'__lifted> for ExistentialPredicate<'tcx>

§

type Lifted = ExistentialPredicate<'__lifted>

source§

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

§

type Lifted = Instance<'__lifted>

source§

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

§

type Lifted = PrintClosureAsImpl<'__lifted>

source§

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

source§

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

source§

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

source§

impl<'tcx, '__lifted> Lift<'__lifted> for CoercePredicate<'tcx>

§

type Lifted = CoercePredicate<'__lifted>

source§

impl<'tcx, '__lifted> Lift<'__lifted> for ProjectionPredicate<'tcx>

§

type Lifted = ProjectionPredicate<'__lifted>

source§

impl<'tcx, '__lifted> Lift<'__lifted> for SubtypePredicate<'tcx>

§

type Lifted = SubtypePredicate<'__lifted>

source§

impl<'tcx, '__lifted> Lift<'__lifted> for TraitPredicate<'tcx>

§

type Lifted = TraitPredicate<'__lifted>

source§

impl<'tcx, '__lifted> Lift<'__lifted> for AliasTy<'tcx>

§

type Lifted = AliasTy<'__lifted>

source§

impl<'tcx, '__lifted> Lift<'__lifted> for ClosureArgs<'tcx>

§

type Lifted = ClosureArgs<'__lifted>

source§

impl<'tcx, '__lifted> Lift<'__lifted> for ExistentialProjection<'tcx>

source§

impl<'tcx, '__lifted> Lift<'__lifted> for ExistentialTraitRef<'tcx>

§

type Lifted = ExistentialTraitRef<'__lifted>

source§

impl<'tcx, '__lifted> Lift<'__lifted> for FnSig<'tcx>

§

type Lifted = FnSig<'__lifted>

source§

impl<'tcx, '__lifted> Lift<'__lifted> for TraitRef<'tcx>

§

type Lifted = TraitRef<'__lifted>

source§

impl<'tcx, '__lifted> Lift<'__lifted> for TypeAndMut<'tcx>

§

type Lifted = TypeAndMut<'__lifted>

source§

impl<'tcx, '__lifted, T> Lift<'__lifted> for Binder<'tcx, T>where T: Lift<'__lifted>,

§

type Lifted = Binder<'__lifted, <T as Lift<'__lifted>>::Lifted>