Struct rustc::ty::Binder
[−]
[src]
pub struct Binder<T>(pub T);
rustc_private
)Binder is a binder for higher-ranked lifetimes. It is part of the
compiler's representation for things like for<'a> Fn(&'a isize)
(which would be represented by the type PolyTraitRef == Binder<TraitRef>
). Note that when we skolemize, instantiate,
erase, or otherwise "discharge" these bound regions, we change the
type from Binder<T>
to just T
(see
e.g. liberate_late_bound_regions
).
Methods
impl<T> Binder<T>
[src]
fn skip_binder(&self) -> &T
rustc_private
)Skips the binder and returns the "bound" value. This is a
risky thing to do because it's easy to get confused about
debruijn indices and the like. It is usually better to
discharge the binder using no_late_bound_regions
or
replace_late_bound_regions
or something like
that. skip_binder
is only valid when you are either
extracting data that has nothing to do with bound regions, you
are doing some sort of test that does not involve bound
regions, or you are being very careful about your depth
accounting.
Some examples where skip_binder
is reasonable:
- extracting the def-id from a PolyTraitRef;
- comparing the self type of a PolyTraitRef to see if it is equal to
a type parameter X
, since the type X
does not reference any regions
fn as_ref(&self) -> Binder<&T>
fn map_bound_ref<F, U>(&self, f: F) -> Binder<U> where F: FnOnce(&T) -> U
fn map_bound<F, U>(self, f: F) -> Binder<U> where F: FnOnce(T) -> U
Trait Implementations
impl<'tcx, T: Relate<'tcx>> Relate<'tcx> for Binder<T>
[src]
fn relate<'a, 'gcx, R>(relation: &mut R, a: &Binder<T>, b: &Binder<T>) -> RelateResult<'tcx, Binder<T>> where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a + 'tcx, 'tcx: 'a
impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Binder<T>
[src]
type Lifted = Binder<T::Lifted>
fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option<Self::Lifted>
impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for Binder<T>
[src]
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self
fn fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool
fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool
fn has_regions_escaping_depth(&self, depth: u32) -> bool
fn has_escaping_regions(&self) -> bool
fn has_type_flags(&self, flags: TypeFlags) -> bool
fn has_projection_types(&self) -> bool
fn references_error(&self) -> bool
fn has_param_types(&self) -> bool
fn has_self_ty(&self) -> bool
fn has_infer_types(&self) -> bool
fn needs_infer(&self) -> bool
fn needs_subst(&self) -> bool
fn has_closure_types(&self) -> bool
fn has_erasable_regions(&self) -> bool
fn is_global(&self) -> bool
Indicates whether this value references only 'global' types/lifetimes that are the same regardless of what fn we are in. This is used for caching. Errs on the side of returning false. Read more
impl<'tcx> Display for Binder<TraitRef<'tcx>>
[src]
impl<'tcx> Display for Binder<TraitPredicate<'tcx>>
[src]
impl<'tcx> Display for Binder<EquatePredicate<'tcx>>
[src]
impl<'tcx> Display for Binder<ProjectionPredicate<'tcx>>
[src]
impl<'tcx> Display for Binder<OutlivesPredicate<Ty<'tcx>, Region>>
[src]
impl Display for Binder<OutlivesPredicate<Region, Region>>
[src]
Derived Implementations
impl<T: Debug> Debug for Binder<T>
[src]
impl<T: Hash> Hash for Binder<T>
[src]
fn hash<__HT: Hasher>(&self, __arg_0: &mut __HT)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0
Feeds a slice of this type into the state provided.
impl<T: Eq> Eq for Binder<T>
[src]
impl<T: PartialEq> PartialEq for Binder<T>
[src]
fn eq(&self, __arg_0: &Binder<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Binder<T>) -> bool
This method tests for !=
.
impl<T: Clone> Clone for Binder<T>
[src]
fn clone(&self) -> Binder<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more