[−][src]Struct rustc::ty::Binder
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Binder is a binder for higher-ranked lifetimes or types. 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 instantiate,
erase, or otherwise "discharge" these bound vars, we change the
type from Binder<T>
to just T
(see
e.g., liberate_late_bound_regions
).
Methods
impl<'tcx> Binder<TraitRef<'tcx>>
[src]
pub fn print_only_trait_path(self) -> Binder<TraitRefPrintOnlyTraitPath<'tcx>>
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
impl<'tcx> Binder<ExistentialPredicate<'tcx>>
[src]
pub fn with_self_ty(
&self,
tcx: TyCtxt<'tcx>,
self_ty: Ty<'tcx>
) -> Predicate<'tcx>
[src]
&self,
tcx: TyCtxt<'tcx>,
self_ty: Ty<'tcx>
) -> Predicate<'tcx>
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
impl<'tcx> Binder<&'tcx List<ExistentialPredicate<'tcx>>>
[src]
pub fn principal(&self) -> Option<Binder<ExistentialTraitRef<'tcx>>>
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn principal_def_id(&self) -> Option<DefId>
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn projection_bounds<'a>(
&'a self
) -> impl Iterator<Item = PolyExistentialProjection<'tcx>> + 'a
[src]
&'a self
) -> impl Iterator<Item = PolyExistentialProjection<'tcx>> + 'a
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn auto_traits<'a>(&'a self) -> impl Iterator<Item = DefId> + 'a
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn iter<'a>(
&'a self
) -> impl DoubleEndedIterator<Item = Binder<ExistentialPredicate<'tcx>>> + 'tcx
[src]
&'a self
) -> impl DoubleEndedIterator<Item = Binder<ExistentialPredicate<'tcx>>> + 'tcx
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
impl<T> Binder<T>
[src]
pub fn dummy<'tcx>(value: T) -> Binder<T> where
T: TypeFoldable<'tcx>,
[src]
T: TypeFoldable<'tcx>,
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Wraps value
in a binder, asserting that value
does not
contain any bound vars that would be bound by the
binder. This is commonly used to 'inject' a value T into a
different binding level.
pub fn bind(value: T) -> Binder<T>
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Wraps value
in a binder, binding higher-ranked vars (if any).
pub fn skip_binder(&self) -> &T
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Skips the binder and returns the "bound" value. This is a
risky thing to do because it's easy to get confused about
De Bruijn indices and the like. It is usually better to
discharge the binder using no_bound_vars
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 vars, 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
DefId
from a PolyTraitRef; - comparing the self type of a PolyTraitRef to see if it is equal to
a type parameter
X
, since the typeX
does not reference any regions
pub fn as_ref(&self) -> Binder<&T>
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn map_bound_ref<F, U>(&self, f: F) -> Binder<U> where
F: FnOnce(&T) -> U,
[src]
F: FnOnce(&T) -> U,
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn map_bound<F, U>(self, f: F) -> Binder<U> where
F: FnOnce(T) -> U,
[src]
F: FnOnce(T) -> U,
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn no_bound_vars<'tcx>(self) -> Option<T> where
T: TypeFoldable<'tcx>,
[src]
T: TypeFoldable<'tcx>,
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Unwraps and returns the value within, but only if it contains
no bound vars at all. (In other words, if this binder --
and indeed any enclosing binder -- doesn't bind anything at
all.) Otherwise, returns None
.
(One could imagine having a method that just unwraps a single binder, but permits late-bound vars bound by enclosing binders, but that would require adjusting the debruijn indices, and given the shallow binding structure we often use, would not be that useful.)
pub fn fuse<U, F, R>(self, u: Binder<U>, f: F) -> Binder<R> where
F: FnOnce(T, U) -> R,
[src]
F: FnOnce(T, U) -> R,
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Given two things that have the same binder level, and an operation that wraps on their contents, executes the operation and then wraps its result.
f
should consider bound regions at depth 1 to be free, and
anything it produces with bound regions at depth 1 will be
bound in the resulting return value.
pub fn split<U, V, F>(self, f: F) -> (Binder<U>, Binder<V>) where
F: FnOnce(T) -> (U, V),
[src]
F: FnOnce(T) -> (U, V),
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Splits the contents into two things that share the same binder level as the original, returning two distinct binders.
f
should consider bound regions at depth 1 to be free, and
anything it produces with bound regions at depth 1 will be
bound in the resulting return values.
Trait Implementations
impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for Binder<T>
[src]
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self
[src]
fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self
[src]
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool
[src]
fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool
[src]
fn has_vars_bound_at_or_above(&self, binder: DebruijnIndex) -> bool
[src]
fn has_vars_bound_above(&self, binder: DebruijnIndex) -> bool
[src]
fn has_escaping_bound_vars(&self) -> bool
[src]
fn has_type_flags(&self, flags: TypeFlags) -> bool
[src]
fn has_projections(&self) -> bool
[src]
fn references_error(&self) -> bool
[src]
fn has_param_types(&self) -> bool
[src]
fn has_infer_types(&self) -> bool
[src]
fn has_infer_consts(&self) -> bool
[src]
fn has_local_value(&self) -> bool
[src]
fn needs_infer(&self) -> bool
[src]
fn has_placeholders(&self) -> bool
[src]
fn needs_subst(&self) -> bool
[src]
fn has_re_placeholders(&self) -> bool
[src]
fn has_closure_types(&self) -> bool
[src]
fn has_free_regions(&self) -> bool
[src]
fn has_erasable_regions(&self) -> bool
[src]
fn is_global(&self) -> bool
[src]
fn has_late_bound_regions(&self) -> bool
[src]
fn visit_tys_shallow(&self, visit: impl FnMut(Ty<'tcx>) -> bool) -> bool
[src]
impl<'tcx, T, P: PrettyPrinter<'tcx>> Print<'tcx, P> for Binder<T> where
T: Print<'tcx, P, Output = P, Error = P::Error> + TypeFoldable<'tcx>,
[src]
T: Print<'tcx, P, Output = P, Error = P::Error> + TypeFoldable<'tcx>,
type Output = P
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
type Error = P::Error
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
fn print(&self, cx: P) -> Result<Self::Output, Self::Error>
[src]
impl<'tcx, T: Relate<'tcx>> Relate<'tcx> for Binder<T>
[src]
fn relate<R: TypeRelation<'tcx>>(
relation: &mut R,
a: &Binder<T>,
b: &Binder<T>
) -> RelateResult<'tcx, Binder<T>>
[src]
relation: &mut R,
a: &Binder<T>,
b: &Binder<T>
) -> RelateResult<'tcx, Binder<T>>
impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Binder<T>
[src]
type Lifted = Binder<T::Lifted>
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
fn lift_to_tcx(&self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted>
[src]
impl<T: Clone> Clone for Binder<T>
[src]
impl<T: Copy> Copy for Binder<T>
[src]
impl<T: Eq> Eq for Binder<T>
[src]
impl<T: Ord> Ord for Binder<T>
[src]
fn cmp(&self, other: &Binder<T>) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T: PartialEq> PartialEq<Binder<T>> for Binder<T>
[src]
impl<T: PartialOrd> PartialOrd<Binder<T>> for Binder<T>
[src]
fn partial_cmp(&self, other: &Binder<T>) -> Option<Ordering>
[src]
fn lt(&self, other: &Binder<T>) -> bool
[src]
fn le(&self, other: &Binder<T>) -> bool
[src]
fn gt(&self, other: &Binder<T>) -> bool
[src]
fn ge(&self, other: &Binder<T>) -> bool
[src]
impl<T: Debug> Debug for Binder<T>
[src]
impl<'tcx> Display for Binder<&'tcx List<ExistentialPredicate<'tcx>>>
[src]
impl<'tcx> Display for Binder<TraitRef<'tcx>>
[src]
impl<'tcx> Display for Binder<TraitRefPrintOnlyTraitPath<'tcx>>
[src]
impl<'tcx> Display for Binder<FnSig<'tcx>>
[src]
impl<'tcx> Display for Binder<TraitPredicate<'tcx>>
[src]
impl<'tcx> Display for Binder<SubtypePredicate<'tcx>>
[src]
impl<'tcx> Display for Binder<ProjectionPredicate<'tcx>>
[src]
impl<'tcx> Display for Binder<OutlivesPredicate<Ty<'tcx>, Region<'tcx>>>
[src]
impl<'tcx> Display for Binder<OutlivesPredicate<Region<'tcx>, Region<'tcx>>>
[src]
impl<T: Hash> Hash for Binder<T>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T> StructuralPartialEq for Binder<T>
[src]
impl<T> StructuralEq for Binder<T>
[src]
impl<T: Encodable> Encodable for Binder<T>
[src]
impl<T: Decodable> Decodable for Binder<T>
[src]
impl<'a, T> HashStable<StableHashingContext<'a>> for Binder<T> where
T: HashStable<StableHashingContext<'a>>,
[src]
T: HashStable<StableHashingContext<'a>>,
fn hash_stable(
&self,
hcx: &mut StableHashingContext<'a>,
hasher: &mut StableHasher
)
[src]
&self,
hcx: &mut StableHashingContext<'a>,
hasher: &mut StableHasher
)
Auto Trait Implementations
impl<T> Send for Binder<T> where
T: Send,
T: Send,
impl<T> Sync for Binder<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Binder<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Binder<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> RefUnwindSafe for Binder<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> ArenaAllocatable for T where
T: Copy,
[src]
T: Copy,
impl<T> MaybeResult<T> for T
[src]
type Error = !
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
fn from(Result<T, <T as MaybeResult<T>>::Error>) -> T
[src]
fn to_result(Self) -> Result<T, <T as MaybeResult<T>>::Error>
[src]
impl<'tcx, T> Subst<'tcx> for T where
T: TypeFoldable<'tcx>,
[src]
T: TypeFoldable<'tcx>,
fn subst_spanned(&Self, TyCtxt<'tcx>, &[GenericArg<'tcx>], Option<Span>) -> T
[src]
fn subst(&self, tcx: TyCtxt<'tcx>, substs: &[GenericArg<'tcx>]) -> Self
[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Encodable for T where
T: UseSpecializedEncodable + ?Sized,
[src]
T: UseSpecializedEncodable + ?Sized,
impl<T> Decodable for T where
T: UseSpecializedDecodable,
[src]
T: UseSpecializedDecodable,
impl<T> Erased for T
[src]
impl<E> SpecializationError for E
[src]
default fn not_found<S, T>(
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,
[src]
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,