Trait rustc::ty::Lift
[−]
[src]
pub trait Lift<'tcx> { type Lifted; fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option<Self::Lifted>; }
rustc_private
)A trait implemented for all X<'a> types which 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 &'tcx Substs<'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 TypeVariants 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.
Associated Types
type Lifted
rustc_private
)Required Methods
fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option<Self::Lifted>
rustc_private
)Implementors
impl<'a, 'tcx> Lift<'tcx> for SelectionError<'a>
impl<'a, 'tcx> Lift<'tcx> for Vtable<'a, ()>
impl<'a, 'tcx> Lift<'tcx> for Ty<'a>
impl<'a, 'tcx> Lift<'tcx> for &'a Substs<'a>
impl<'a, 'tcx> Lift<'tcx> for &'a Region
impl<'a, 'tcx> Lift<'tcx> for &'a [Ty<'a>]
impl<'a, 'tcx> Lift<'tcx> for &'a BareFnTy<'a>
impl<'tcx, A: Lift<'tcx>, B: Lift<'tcx>> Lift<'tcx> for (A, B)
impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Option<T>
impl<'tcx, T: Lift<'tcx>, E: Lift<'tcx>> Lift<'tcx> for Result<T, E>
impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for [T]
impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Vec<T>
impl<'tcx> Lift<'tcx> for Region
impl<'a, 'tcx> Lift<'tcx> for TraitRef<'a>
impl<'a, 'tcx> Lift<'tcx> for TraitPredicate<'a>
impl<'a, 'tcx> Lift<'tcx> for EquatePredicate<'a>
impl<'tcx, A: Copy + Lift<'tcx>, B: Copy + Lift<'tcx>> Lift<'tcx> for OutlivesPredicate<A, B>
impl<'a, 'tcx> Lift<'tcx> for ProjectionPredicate<'a>
impl<'a, 'tcx> Lift<'tcx> for Predicate<'a>
impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Binder<T>
impl<'a, 'tcx> Lift<'tcx> for ClosureSubsts<'a>
impl<'a, 'tcx> Lift<'tcx> for ItemSubsts<'a>
impl<'a, 'tcx> Lift<'tcx> for AutoRef<'a>
impl<'a, 'tcx> Lift<'tcx> for FnOutput<'a>
impl<'a, 'tcx> Lift<'tcx> for FnSig<'a>
impl<'a, 'tcx> Lift<'tcx> for ClosureTy<'a>
impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for ExpectedFound<T>
impl<'a, 'tcx> Lift<'tcx> for Default<'a>
impl<'a, 'tcx> Lift<'tcx> for TypeError<'a>