Type Alias CanonicalResponse
pub type CanonicalResponse<I> = Canonical<I, Response<I>>;
Aliased Type§
struct CanonicalResponse<I> {
pub value: Response<I>,
pub max_universe: UniverseIndex,
pub variables: <I as Interner>::CanonicalVars,
}
Fields§
§value: Response<I>
§max_universe: UniverseIndex
§variables: <I as Interner>::CanonicalVars
Layout§
Note: Encountered an error during type layout; the type failed to be normalized.
Implementations
§impl<I, V> Canonical<I, V>where
I: Interner,
impl<I, V> Canonical<I, V>where
I: Interner,
pub fn unchecked_map<W>(self, map_op: impl FnOnce(V) -> W) -> Canonical<I, W>
pub fn unchecked_map<W>(self, map_op: impl FnOnce(V) -> W) -> Canonical<I, 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<I, T> = ...;
let b: Canonical<I, (T,)> = a.unchecked_map(|v| (v, ));
An example of an incorrect use of this:
ⓘ
let a: Canonical<I, T> = ...;
let ty: Ty<I> = ...;
let b: Canonical<I, (T, Ty<I>)> = a.unchecked_map(|v| (v, ty));