pub type CanonicalInput<'tcx, T = Predicate<'tcx>> = Canonical<'tcx, QueryInput<'tcx, T>>;

Aliased Type§

struct CanonicalInput<'tcx, T = Predicate<'tcx>> {
    pub value: QueryInput<'tcx, T>,
    pub max_universe: UniverseIndex,
    pub variables: &'tcx List<CanonicalVarInfo<'tcx>>,
}

Fields§

§value: QueryInput<'tcx, T>§max_universe: UniverseIndex§variables: &'tcx List<CanonicalVarInfo<'tcx>>

Implementations§

source§

impl<'tcx, V> Canonical<'tcx, V>

source

pub fn unchecked_map<W>(self, map_op: impl FnOnce(V) -> W) -> Canonical<'tcx, W>

Allows you to map the value of a canonical while keeping the same set of bound variables.

WARNING: This function is very easy to mis-use, hence the name! In particular, the new value W must use all the same type/region variables in precisely the same order as the original! (The ordering is defined by the TypeFoldable implementation of the type in question.)

An example of a correct use of this:

let a: Canonical<'_, T> = ...;
let b: Canonical<'_, (T,)> = a.unchecked_map(|v| (v, ));

An example of an incorrect use of this:

let a: Canonical<'tcx, T> = ...;
let ty: Ty<'tcx> = ...;
let b: Canonical<'tcx, (T, Ty<'tcx>)> = a.unchecked_map(|v| (v, ty));
source

pub fn unchecked_rebind<W>(self, value: W) -> Canonical<'tcx, W>

Allows you to map the value of a canonical while keeping the same set of bound variables.

WARNING: This function is very easy to mis-use, hence the name! See the comment of Canonical::unchecked_map for more details.

Trait Implementations§

source§

impl<'tcx, V: Clone> Clone for Canonical<'tcx, V>

source§

fn clone(&self) -> Canonical<'tcx, V>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<'tcx, V: Debug> Debug for Canonical<'tcx, V>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'tcx, V, __D: TyDecoder<I = TyCtxt<'tcx>>> Decodable<__D> for Canonical<'tcx, V>where V: Decodable<__D>,

source§

fn decode(__decoder: &mut __D) -> Self

source§

impl<'tcx, V: Display> Display for Canonical<'tcx, V>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'tcx, V, __E: TyEncoder<I = TyCtxt<'tcx>>> Encodable<__E> for Canonical<'tcx, V>where V: Encodable<__E>,

source§

fn encode(&self, __encoder: &mut __E)

source§

impl<'tcx, V: Hash> Hash for Canonical<'tcx, V>

source§

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

Feeds this value into the given Hasher. Read more
1.3.0 · source§

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

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'tcx, '__ctx, V> HashStable<StableHashingContext<'__ctx>> for Canonical<'tcx, V>where V: HashStable<StableHashingContext<'__ctx>>,

source§

fn hash_stable( &self, __hcx: &mut StableHashingContext<'__ctx>, __hasher: &mut StableHasher )

source§

impl<'tcx, T: Clone> Key for Canonical<'tcx, T>

Canonical query goals correspond to abstract trait operations that are not tied to any crate in particular.

§

type CacheSelector = DefaultCacheSelector<Canonical<'tcx, T>>

source§

fn default_span(&self, _tcx: TyCtxt<'_>) -> Span

In the event that a cycle occurs, if no explicit span has been given for a query with key self, what span should we use?
source§

fn key_as_def_id(&self) -> Option<DefId>

If the key is a DefId or DefId–equivalent, return that DefId. Otherwise, return None.
source§

fn ty_adt_id(&self) -> Option<DefId>

source§

impl<'tcx, V: PartialEq> PartialEq<Canonical<'tcx, V>> for Canonical<'tcx, V>

source§

fn eq(&self, other: &Canonical<'tcx, V>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'tcx, V> TypeFoldable<TyCtxt<'tcx>> for Canonical<'tcx, V>where V: TypeFoldable<TyCtxt<'tcx>>,

source§

fn try_fold_with<__F: FallibleTypeFolder<TyCtxt<'tcx>>>( self, __folder: &mut __F ) -> Result<Self, __F::Error>

The entry point for folding. To fold a value t with a folder f call: t.try_fold_with(f). Read more
source§

fn fold_with<F>(self, folder: &mut F) -> Selfwhere F: TypeFolder<I>,

A convenient alternative to try_fold_with for use with infallible folders. Do not override this method, to ensure coherence with try_fold_with.
source§

impl<'tcx, V> TypeVisitable<TyCtxt<'tcx>> for Canonical<'tcx, V>where V: TypeVisitable<TyCtxt<'tcx>>,

source§

fn visit_with<__V: TypeVisitor<TyCtxt<'tcx>>>( &self, __visitor: &mut __V ) -> ControlFlow<__V::BreakTy>

The entry point for visiting. To visit a value t with a visitor v call: t.visit_with(v). Read more
source§

impl<'tcx, V: Copy> Copy for Canonical<'tcx, V>

source§

impl<'tcx, V: Eq> Eq for Canonical<'tcx, V>

source§

impl<'tcx, V> StructuralEq for Canonical<'tcx, V>

source§

impl<'tcx, V> StructuralPartialEq for Canonical<'tcx, V>

Layout§

Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.