Struct rustc_middle::infer::canonical::Canonical [−][src]
pub struct Canonical<'tcx, V> {
pub max_universe: UniverseIndex,
pub variables: CanonicalVarInfos<'tcx>,
pub value: V,
}
Expand description
A “canonicalized” type V
is one where all free inference
variables have been rewritten to “canonical vars”. These are
numbered starting from 0 in order of first appearance.
Fields
max_universe: UniverseIndex
variables: CanonicalVarInfos<'tcx>
value: V
Implementations
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));
Returns true
if this represents a substitution of the form [?0, ?1, ?2]
,
i.e., each thing is mapped to a canonical variable with the same index.
Trait Implementations
impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, &'tcx TyS<'tcx>>>> for Canonical<'tcx, QueryResponse<'tcx, Ty<'tcx>>>
impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, &'tcx TyS<'tcx>>>> for Canonical<'tcx, QueryResponse<'tcx, Ty<'tcx>>>
fn allocate_from_iter<'a>(
arena: &'a Arena<'tcx>,
iter: impl IntoIterator<Item = Self>
) -> &'a mut [Self]
impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, ()>>> for Canonical<'tcx, QueryResponse<'tcx, ()>>
impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, ()>>> for Canonical<'tcx, QueryResponse<'tcx, ()>>
fn allocate_from_iter<'a>(
arena: &'a Arena<'tcx>,
iter: impl IntoIterator<Item = Self>
) -> &'a mut [Self]
impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, Binder<'tcx, FnSig<'tcx>>>>> for Canonical<'tcx, QueryResponse<'tcx, PolyFnSig<'tcx>>>
impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, Binder<'tcx, FnSig<'tcx>>>>> for Canonical<'tcx, QueryResponse<'tcx, PolyFnSig<'tcx>>>
fn allocate_from_iter<'a>(
arena: &'a Arena<'tcx>,
iter: impl IntoIterator<Item = Self>
) -> &'a mut [Self]
impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, DropckOutlivesResult<'tcx>>>> for Canonical<'tcx, QueryResponse<'tcx, DropckOutlivesResult<'tcx>>>
impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, DropckOutlivesResult<'tcx>>>> for Canonical<'tcx, QueryResponse<'tcx, DropckOutlivesResult<'tcx>>>
fn allocate_from_iter<'a>(
arena: &'a Arena<'tcx>,
iter: impl IntoIterator<Item = Self>
) -> &'a mut [Self]
impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, FnSig<'tcx>>>> for Canonical<'tcx, QueryResponse<'tcx, FnSig<'tcx>>>
impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, FnSig<'tcx>>>> for Canonical<'tcx, QueryResponse<'tcx, FnSig<'tcx>>>
fn allocate_from_iter<'a>(
arena: &'a Arena<'tcx>,
iter: impl IntoIterator<Item = Self>
) -> &'a mut [Self]
impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, NormalizationResult<'tcx>>>> for Canonical<'tcx, QueryResponse<'tcx, NormalizationResult<'tcx>>>
impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, NormalizationResult<'tcx>>>> for Canonical<'tcx, QueryResponse<'tcx, NormalizationResult<'tcx>>>
fn allocate_from_iter<'a>(
arena: &'a Arena<'tcx>,
iter: impl IntoIterator<Item = Self>
) -> &'a mut [Self]
impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, Predicate<'tcx>>>> for Canonical<'tcx, QueryResponse<'tcx, Predicate<'tcx>>>
impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, Predicate<'tcx>>>> for Canonical<'tcx, QueryResponse<'tcx, Predicate<'tcx>>>
fn allocate_from_iter<'a>(
arena: &'a Arena<'tcx>,
iter: impl IntoIterator<Item = Self>
) -> &'a mut [Self]
impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, Vec<OutlivesBound<'tcx>, Global>>>> for Canonical<'tcx, QueryResponse<'tcx, Vec<OutlivesBound<'tcx>>>>
impl<'tcx> ArenaAllocatable<'tcx, Canonical<'tcx, QueryResponse<'tcx, Vec<OutlivesBound<'tcx>, Global>>>> for Canonical<'tcx, QueryResponse<'tcx, Vec<OutlivesBound<'tcx>>>>
fn allocate_from_iter<'a>(
arena: &'a Arena<'tcx>,
iter: impl IntoIterator<Item = Self>
) -> &'a mut [Self]
impl<'tcx, '__ctx, V> HashStable<StableHashingContext<'__ctx>> for Canonical<'tcx, V> where
V: HashStable<StableHashingContext<'__ctx>>,
impl<'tcx, '__ctx, V> HashStable<StableHashingContext<'__ctx>> for Canonical<'tcx, V> where
V: HashStable<StableHashingContext<'__ctx>>,
fn super_visit_with<__F: TypeVisitor<'tcx>>(
&self,
__folder: &mut __F
) -> ControlFlow<__F::BreakTy>
Returns true
if self
has any late-bound regions that are either
bound by binder
or bound by some binder outside of binder
.
If binder
is ty::INNERMOST
, this indicates whether
there are any late-bound regions that appear free. Read more
Returns true
if this self
has any regions that escape binder
(and
hence are not bound by it). Read more
“Free” regions in this context means that it has any region that is not (a) erased or (b) late-bound. Read more
True if there are any un-erased free regions.
Indicates whether this value definitely references only ‘global’ generic parameters that are the same regardless of what fn we are in. This is used for caching. Read more
Indicates whether this value references only ‘global’ generic parameters that are the same regardless of what fn we are in. This is used for caching. Read more
True if there are any late-bound regions
Indicates whether this value still has parameters/placeholders/inference variables
which could be replaced later, in a way that would change the results of impl
specialization. Read more
Auto Trait Implementations
impl<'tcx, V> !RefUnwindSafe for Canonical<'tcx, V>
impl<'tcx, V> !UnwindSafe for Canonical<'tcx, V>
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<Ctxt, T> DepNodeParams<Ctxt> for T where
Ctxt: DepContext,
T: for<'a> HashStable<StableHashingContext<'a>> + Debug,
impl<Ctxt, T> DepNodeParams<Ctxt> for T where
Ctxt: DepContext,
T: for<'a> HashStable<StableHashingContext<'a>> + Debug,
This method turns the parameters of a DepNodeConstructor into an opaque Fingerprint to be used in DepNode. Not all DepNodeParams support being turned into a Fingerprint (they don’t need to if the corresponding DepNode is anonymous). Read more
This method tries to recover the query key from the given DepNode
,
something which is needed when forcing DepNode
s during red-green
evaluation. The query system will only call this method if
fingerprint_style()
is not FingerprintStyle::Opaque
.
It is always valid to return None
here, in which case incremental
compilation will treat the query as having changed instead of forcing it. Read more
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.