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<'a, 'gcx, 'tcx> Binder<ExistentialPredicate<'tcx>>
[src]
fn with_self_ty(&self,
tcx: TyCtxt<'a, 'gcx, 'tcx>,
self_ty: Ty<'tcx>)
-> Predicate<'tcx>
tcx: TyCtxt<'a, 'gcx, 'tcx>,
self_ty: Ty<'tcx>)
-> Predicate<'tcx>
rustc_private
)impl<'tcx> Binder<&'tcx Slice<ExistentialPredicate<'tcx>>>
[src]
fn principal(&self) -> Option<PolyExistentialTraitRef<'tcx>>
rustc_private
)fn projection_bounds<'a>(&'a self)
-> impl Iterator<Item=PolyExistentialProjection<'tcx>> + 'a
-> impl Iterator<Item=PolyExistentialProjection<'tcx>> + 'a
rustc_private
)fn auto_traits<'a>(&'a self) -> impl Iterator<Item=DefId> + 'a
rustc_private
)fn iter<'a>(&'a self)
-> impl DoubleEndedIterator<Item=Binder<ExistentialPredicate<'tcx>>> + 'tcx
-> impl DoubleEndedIterator<Item=Binder<ExistentialPredicate<'tcx>>> + 'tcx
rustc_private
)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>
rustc_private
)fn map_bound_ref<F, U>(&self, f: F) -> Binder<U> where F: FnOnce(&T) -> U
rustc_private
)fn map_bound<F, U>(self, f: F) -> Binder<U> where F: FnOnce(T) -> U
rustc_private
)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
a: &Binder<T>,
b: &Binder<T>)
-> RelateResult<'tcx, Binder<T>> where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'a + 'tcx, 'tcx: 'a
rustc_private
)impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Binder<T>
[src]
type Lifted = Binder<T::Lifted>
rustc_private
)fn lift_to_tcx<'a, 'gcx>(&self,
tcx: TyCtxt<'a, 'gcx, 'tcx>)
-> Option<Self::Lifted>
tcx: TyCtxt<'a, 'gcx, 'tcx>)
-> Option<Self::Lifted>
rustc_private
)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
folder: &mut F)
-> Self
rustc_private
)fn fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self,
folder: &mut F)
-> Self
folder: &mut F)
-> Self
rustc_private
)fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool
rustc_private
)fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool
rustc_private
)fn has_regions_escaping_depth(&self, depth: u32) -> bool
rustc_private
)fn has_escaping_regions(&self) -> bool
rustc_private
)fn has_type_flags(&self, flags: TypeFlags) -> bool
rustc_private
)fn has_projection_types(&self) -> bool
rustc_private
)fn references_error(&self) -> bool
rustc_private
)fn has_param_types(&self) -> bool
rustc_private
)fn has_self_ty(&self) -> bool
rustc_private
)fn has_infer_types(&self) -> bool
rustc_private
)fn needs_infer(&self) -> bool
rustc_private
)fn needs_subst(&self) -> bool
rustc_private
)fn has_re_skol(&self) -> bool
rustc_private
)fn has_closure_types(&self) -> bool
rustc_private
)fn has_erasable_regions(&self) -> bool
rustc_private
)fn is_normalized_for_trans(&self) -> bool
rustc_private
)fn is_global(&self) -> bool
rustc_private
)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<T: Copy> Copy for Binder<T>
[src]
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
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: Eq> Eq 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: Debug> Debug for Binder<T>
[src]
impl<T: Encodable> Encodable for Binder<T>
[src]
fn encode<__ST: Encoder>(&self, __arg_0: &mut __ST) -> Result<(), __ST::Error>
🔬 This is a nightly-only experimental API. (rustc_private
)
deprecated in favor of rustc-serialize on crates.io
impl<T: Decodable> Decodable for Binder<T>
[src]
fn decode<__DT: Decoder>(__arg_0: &mut __DT) -> Result<Binder<T>, __DT::Error>
🔬 This is a nightly-only experimental API. (rustc_private
)
deprecated in favor of rustc-serialize on crates.io