Enum BoundVarIndexKind
pub enum BoundVarIndexKind {
Bound(DebruijnIndex),
Canonical,
}Expand description
Okay, we do something fun for Bound types/regions/consts:
Specifically, we distinguish between canonically bound things and
for<> bound things. And, really, it comes down to caching during
canonicalization and instantiation.
To understand why we do this, imagine we have a type (T, for<> fn(T)).
If we just tracked canonically bound types with a DebruijnIndex (as we
used to), then the canonicalized type would be something like
for<0> (^0.0, for<> fn(^1.0)) and so we can’t cache T -> ^0.0,
we have to also factor in binder level. (Of course, we don’t cache that
exactly, but rather the entire enclosing type, but the point stands.)
Of course, this is okay because we don’t ever nest canonicalization, so
BoundVarIndexKind::Canonical is unambiguous. We, alternatively, could
have some sentinel DebruijinIndex, but that just seems too scary.
This doesn’t seem to have a huge perf swing either way, but in the next
solver, canonicalization is hot and there are some pathological cases where
this is needed (post-mono-higher-ranked-hang).
Variants§
Bound(DebruijnIndex)
Canonical
Trait Implementations§
Source§impl<S> SInto<S, BoundVarIndexKind> for BoundVarIndexKind
impl<S> SInto<S, BoundVarIndexKind> for BoundVarIndexKind
fn sinto(&self, _s: &S) -> BoundVarIndexKind
Auto Trait Implementations§
impl DynSend for BoundVarIndexKind
impl DynSync for BoundVarIndexKind
impl Forget for BoundVarIndexKind
impl Freeze for BoundVarIndexKind
impl Move for BoundVarIndexKind
impl RefUnwindSafe for BoundVarIndexKind
impl Send for BoundVarIndexKind
impl Sync for BoundVarIndexKind
impl Unpin for BoundVarIndexKind
impl UnsafeUnpin for BoundVarIndexKind
impl UnwindSafe for BoundVarIndexKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Dedup for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> HashConsable for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more