Type Alias rustc_middle::query::queries::item_bounds::Value
source · pub type Value<'tcx> = EarlyBinder<&'tcx List<Clause<'tcx>>>;Aliased Type§
struct Value<'tcx> {
value: &'tcx List<Clause<'tcx>>,
}Fields§
§value: &'tcx List<Clause<'tcx>>Implementations§
source§impl<T> EarlyBinder<T>
impl<T> EarlyBinder<T>
pub fn bind(value: T) -> EarlyBinder<T>
pub fn as_ref(&self) -> EarlyBinder<&T>
pub fn map_bound_ref<F, U>(&self, f: F) -> EarlyBinder<U>where F: FnOnce(&T) -> U,
pub fn map_bound<F, U>(self, f: F) -> EarlyBinder<U>where F: FnOnce(T) -> U,
pub fn try_map_bound<F, U, E>(self, f: F) -> Result<EarlyBinder<U>, E>where F: FnOnce(T) -> Result<U, E>,
pub fn rebind<U>(&self, value: U) -> EarlyBinder<U>
sourcepub fn skip_binder(self) -> T
pub fn skip_binder(self) -> T
Skips the binder and returns the “bound” value.
This can be used to extract data that does not depend on generic parameters
(e.g., getting the DefId of the inner value or getting the number of
arguments of an FnSig). Otherwise, consider using
instantiate_identity.
To skip the binder on x: &EarlyBinder<T> to obtain &T, leverage
EarlyBinder::as_ref: x.as_ref().skip_binder().
See also Binder::skip_binder, which is
the analogous operation on super::Binder.
source§impl<'tcx, 's, I: IntoIterator> EarlyBinder<I>where
I::Item: TypeFoldable<TyCtxt<'tcx>>,
impl<'tcx, 's, I: IntoIterator> EarlyBinder<I>where I::Item: TypeFoldable<TyCtxt<'tcx>>,
pub fn iter_instantiated( self, tcx: TyCtxt<'tcx>, args: &'s [GenericArg<'tcx>] ) -> IterInstantiated<'s, 'tcx, I> ⓘ
sourcepub fn instantiate_identity_iter(self) -> I::IntoIter
pub fn instantiate_identity_iter(self) -> I::IntoIter
Similar to instantiate_identity,
but on an iterator of TypeFoldable values.
source§impl<'tcx, 's, I: IntoIterator> EarlyBinder<I>where
I::Item: Deref,
<<I as IntoIterator>::Item as Deref>::Target: Copy + TypeFoldable<TyCtxt<'tcx>>,
impl<'tcx, 's, I: IntoIterator> EarlyBinder<I>where I::Item: Deref, <<I as IntoIterator>::Item as Deref>::Target: Copy + TypeFoldable<TyCtxt<'tcx>>,
pub fn iter_instantiated_copied( self, tcx: TyCtxt<'tcx>, args: &'s [GenericArg<'tcx>] ) -> IterInstantiatedCopied<'s, 'tcx, I> ⓘ
sourcepub fn instantiate_identity_iter_copied(
self
) -> impl Iterator<Item = <<I as IntoIterator>::Item as Deref>::Target>
pub fn instantiate_identity_iter_copied( self ) -> impl Iterator<Item = <<I as IntoIterator>::Item as Deref>::Target>
Similar to instantiate_identity,
but on an iterator of values that deref to a TypeFoldable.
source§impl<T: IntoIterator> EarlyBinder<T>
impl<T: IntoIterator> EarlyBinder<T>
pub fn transpose_iter(self) -> EarlyBinderIter<T::IntoIter> ⓘ
source§impl<'tcx, T: TypeFoldable<TyCtxt<'tcx>>> EarlyBinder<T>
impl<'tcx, T: TypeFoldable<TyCtxt<'tcx>>> EarlyBinder<T>
pub fn instantiate(self, tcx: TyCtxt<'tcx>, args: &[GenericArg<'tcx>]) -> T
sourcepub fn instantiate_identity(self) -> T
pub fn instantiate_identity(self) -> T
Makes the identity replacement T0 => T0, ..., TN => TN.
Conceptually, this converts universally bound variables into placeholders
when inside of a given item.
For example, consider for<T> fn foo<T>(){ .. }:
- Outside of
foo,Tis bound (represented by the presence ofEarlyBinder). - Inside of the body of
foo, we treatTas a placeholder by callinginstantiate_identityto discharge theEarlyBinder.
sourcepub fn no_bound_vars(self) -> Option<T>
pub fn no_bound_vars(self) -> Option<T>
Returns the inner value, but only if it contains no bound vars.
Trait Implementations§
source§impl<T: Clone> Clone for EarlyBinder<T>
impl<T: Clone> Clone for EarlyBinder<T>
source§fn clone(&self) -> EarlyBinder<T>
fn clone(&self) -> EarlyBinder<T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<T: Debug> Debug for EarlyBinder<T>
impl<T: Debug> Debug for EarlyBinder<T>
source§impl<T: Hash> Hash for EarlyBinder<T>
impl<T: Hash> Hash for EarlyBinder<T>
source§impl<'__ctx, T> HashStable<StableHashingContext<'__ctx>> for EarlyBinder<T>where
T: HashStable<StableHashingContext<'__ctx>>,
impl<'__ctx, T> HashStable<StableHashingContext<'__ctx>> for EarlyBinder<T>where T: HashStable<StableHashingContext<'__ctx>>,
fn hash_stable( &self, __hcx: &mut StableHashingContext<'__ctx>, __hasher: &mut StableHasher )
source§impl<T: Ord> Ord for EarlyBinder<T>
impl<T: Ord> Ord for EarlyBinder<T>
source§fn cmp(&self, other: &EarlyBinder<T>) -> Ordering
fn cmp(&self, other: &EarlyBinder<T>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl<T: ParameterizedOverTcx> ParameterizedOverTcx for EarlyBinder<T>
impl<T: ParameterizedOverTcx> ParameterizedOverTcx for EarlyBinder<T>
type Value<'tcx> = EarlyBinder<<T as ParameterizedOverTcx>::Value<'tcx>>
source§impl<T: PartialEq> PartialEq<EarlyBinder<T>> for EarlyBinder<T>
impl<T: PartialEq> PartialEq<EarlyBinder<T>> for EarlyBinder<T>
source§fn eq(&self, other: &EarlyBinder<T>) -> bool
fn eq(&self, other: &EarlyBinder<T>) -> bool
self and other values to be equal, and is used
by ==.source§impl<T: PartialOrd> PartialOrd<EarlyBinder<T>> for EarlyBinder<T>
impl<T: PartialOrd> PartialOrd<EarlyBinder<T>> for EarlyBinder<T>
source§fn partial_cmp(&self, other: &EarlyBinder<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &EarlyBinder<T>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§impl<'tcx, T> !TypeFoldable<TyCtxt<'tcx>> for EarlyBinder<T>
impl<'tcx, T> !TypeFoldable<TyCtxt<'tcx>> for EarlyBinder<T>
For early binders, you should first call instantiate before using any visitors.
source§fn try_fold_with<F>(
self,
folder: &mut F
) -> Result<Self, <F as FallibleTypeFolder<I>>::Error>where
F: FallibleTypeFolder<I>,
fn try_fold_with<F>( self, folder: &mut F ) -> Result<Self, <F as FallibleTypeFolder<I>>::Error>where F: FallibleTypeFolder<I>,
source§fn fold_with<F>(self, folder: &mut F) -> Selfwhere
F: TypeFolder<I>,
fn fold_with<F>(self, folder: &mut F) -> Selfwhere F: TypeFolder<I>,
try_fold_with for use with infallible
folders. Do not override this method, to ensure coherence with
try_fold_with.source§impl<'tcx, T> !TypeVisitable<TyCtxt<'tcx>> for EarlyBinder<T>
impl<'tcx, T> !TypeVisitable<TyCtxt<'tcx>> for EarlyBinder<T>
source§fn visit_with<V>(
&self,
visitor: &mut V
) -> ControlFlow<<V as TypeVisitor<I>>::BreakTy, ()>where
V: TypeVisitor<I>,
fn visit_with<V>( &self, visitor: &mut V ) -> ControlFlow<<V as TypeVisitor<I>>::BreakTy, ()>where V: TypeVisitor<I>,
impl<T: Copy> Copy for EarlyBinder<T>
impl<T: Eq> Eq for EarlyBinder<T>
impl<T> StructuralEq for EarlyBinder<T>
impl<T> StructuralPartialEq for EarlyBinder<T>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size:8 bytes