Struct rustc_typeck::middle::ty::Binder [−] [src]

pub struct Binder<T>(pub T);
Unstable

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<'tcx> Binder<FnOutput<'tcx>>

fn diverges(&self) -> bool

Unstable

impl<'tcx> Binder<FnSig<'tcx>>

fn inputs(&self) -> Binder<Vec<&'tcx TyS<'tcx>>>

Unstable

fn input(&self, index: usize) -> Binder<&'tcx TyS<'tcx>>

Unstable

fn output(&self) -> Binder<FnOutput<'tcx>>

Unstable

fn variadic(&self) -> bool

Unstable

impl<'tcx> Binder<TraitRef<'tcx>>

fn self_ty(&self) -> &'tcx TyS<'tcx>

Unstable

fn def_id(&self) -> DefId

Unstable

fn substs(&self) -> &'tcx Substs<'tcx>

Unstable

fn input_types(&self) -> &[&'tcx TyS<'tcx>]

Unstable

fn to_poly_trait_predicate(&self) -> Binder<TraitPredicate<'tcx>>

Unstable

impl<T> Binder<T>

fn skip_binder(&self) -> &T

Unstable

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>

Unstable

fn map_bound_ref<F, U>(&self, f: F) -> Binder<U> where F: FnOnce(&T) -> U

Unstable

fn map_bound<F, U>(self, f: F) -> Binder<U> where F: FnOnce(T) -> U

Unstable

impl<'tcx> Binder<TraitPredicate<'tcx>>

fn def_id(&self) -> DefId

Unstable

impl<'tcx> Binder<ProjectionPredicate<'tcx>>

fn item_name(&self) -> Name

Unstable

fn sort_key(&self) -> (DefId, Name)

Unstable

Trait Implementations

impl<'tcx> Resolvable<'tcx> for Binder<TraitRef<'tcx>>

fn resolve(&self, infcx: &InferCtxt<'a, 'tcx>) -> Binder<TraitRef<'tcx>>

fn contains_error(&self) -> bool

impl<'tcx> ToPolyTraitRef<'tcx> for Binder<TraitPredicate<'tcx>>

fn to_poly_trait_ref(&self) -> Binder<TraitRef<'tcx>>

impl<'tcx> ToPolyTraitRef<'tcx> for Binder<ProjectionPredicate<'tcx>>

fn to_poly_trait_ref(&self) -> Binder<TraitRef<'tcx>>

impl<'tcx> AsPredicate<'tcx> for Binder<TraitRef<'tcx>>

fn as_predicate(&self) -> Predicate<'tcx>

impl<'tcx> AsPredicate<'tcx> for Binder<EquatePredicate<'tcx>>

fn as_predicate(&self) -> Predicate<'tcx>

impl<'tcx> AsPredicate<'tcx> for Binder<OutlivesPredicate<Region, Region>>

fn as_predicate(&self) -> Predicate<'tcx>

impl<'tcx> AsPredicate<'tcx> for Binder<OutlivesPredicate<&'tcx TyS<'tcx>, Region>>

fn as_predicate(&self) -> Predicate<'tcx>

impl<'tcx> AsPredicate<'tcx> for Binder<ProjectionPredicate<'tcx>>

fn as_predicate(&self) -> Predicate<'tcx>

impl<'tcx, T> RegionEscape for Binder<T> where T: RegionEscape

fn has_regions_escaping_depth(&self, depth: u32) -> bool

fn has_escaping_regions(&self) -> bool

impl<T> HasProjectionTypes for Binder<T> where T: HasProjectionTypes

fn has_projection_types(&self) -> bool

impl<T> ReferencesError for Binder<T> where T: ReferencesError

fn references_error(&self) -> bool

impl<'tcx, T> TypeFoldable<'tcx> for Binder<T> where T: TypeFoldable<'tcx> + Repr<'tcx> + Clone

fn fold_with<F>(&self, folder: &mut F) -> Binder<T> where F: TypeFolder<'tcx>

impl<'a, 'tcx, T> Relate<'a, 'tcx> for Binder<T> where 'tcx: 'a, T: Relate<'a, 'tcx>

fn relate<R>(relation: &mut R, a: &Binder<T>, b: &Binder<T>) -> Result<Binder<T>, type_err<'tcx>> where R: TypeRelation<'a, 'tcx>

impl<'tcx, T> UserString<'tcx> for Binder<T> where T: UserString<'tcx> + TypeFoldable<'tcx>

fn user_string(&self, tcx: &ctxt<'tcx>) -> String

impl<'tcx, T> Repr<'tcx> for Binder<T> where T: Repr<'tcx>

fn repr(&self, tcx: &ctxt<'tcx>) -> String

Derived Implementations

impl<T> Debug for Binder<T> where T: Debug + Debug

fn fmt(&self, __arg_0: &mut Formatter) -> Result<(), Error>

impl<T> Hash for Binder<T> where T: Hash + Hash

fn hash<__H>(&self, __arg_0: &mut __H) where __H: Hasher

fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher

impl<T> Eq for Binder<T> where T: Eq + Eq

impl<T> PartialEq<Binder<T>> for Binder<T> where T: PartialEq<T> + PartialEq<T>

fn eq(&self, __arg_0: &Binder<T>) -> bool

fn ne(&self, __arg_0: &Binder<T>) -> bool

impl<T> Clone for Binder<T> where T: Clone + Clone

fn clone(&self) -> Binder<T>

fn clone_from(&mut self, source: &Self)