[][src]Trait rustc_middle::ty::fold::TypeFoldable

pub trait TypeFoldable<'tcx>: Debug + Clone {
    fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self;
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool; fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self { ... }
fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool { ... }
fn has_vars_bound_at_or_above(&self, binder: DebruijnIndex) -> bool { ... }
fn has_vars_bound_above(&self, binder: DebruijnIndex) -> bool { ... }
fn has_escaping_bound_vars(&self) -> bool { ... }
fn has_type_flags(&self, flags: TypeFlags) -> bool { ... }
fn has_projections(&self) -> bool { ... }
fn has_opaque_types(&self) -> bool { ... }
fn references_error(&self) -> bool { ... }
fn has_param_types_or_consts(&self) -> bool { ... }
fn has_infer_regions(&self) -> bool { ... }
fn has_infer_types(&self) -> bool { ... }
fn has_infer_types_or_consts(&self) -> bool { ... }
fn needs_infer(&self) -> bool { ... }
fn has_placeholders(&self) -> bool { ... }
fn needs_subst(&self) -> bool { ... }
fn has_free_regions(&self) -> bool { ... }
fn has_erased_regions(&self) -> bool { ... }
fn has_erasable_regions(&self) -> bool { ... }
fn is_global(&self) -> bool { ... }
fn has_late_bound_regions(&self) -> bool { ... }
fn still_further_specializable(&self) -> bool { ... }
fn visit_tys_shallow(&self, visit: impl FnMut(Ty<'tcx>) -> bool) -> bool { ... } }

This trait is implemented for every type that can be folded. Basically, every type that has a corresponding method in TypeFolder.

To implement this conveniently, use the derive macro located in librustc_macros.

Required methods

fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self

fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool

Loading content...

Provided methods

fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self

fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool

fn has_vars_bound_at_or_above(&self, binder: DebruijnIndex) -> bool

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.

fn has_vars_bound_above(&self, binder: DebruijnIndex) -> bool

Returns true if this self has any regions that escape binder (and hence are not bound by it).

fn has_escaping_bound_vars(&self) -> bool

fn has_type_flags(&self, flags: TypeFlags) -> bool

fn has_projections(&self) -> bool

fn has_opaque_types(&self) -> bool

fn references_error(&self) -> bool

fn has_param_types_or_consts(&self) -> bool

fn has_infer_regions(&self) -> bool

fn has_infer_types(&self) -> bool

fn has_infer_types_or_consts(&self) -> bool

fn needs_infer(&self) -> bool

fn has_placeholders(&self) -> bool

fn needs_subst(&self) -> bool

fn has_free_regions(&self) -> bool

"Free" regions in this context means that it has any region that is not (a) erased or (b) late-bound.

fn has_erased_regions(&self) -> bool

fn has_erasable_regions(&self) -> bool

True if there are any un-erased free regions.

fn is_global(&self) -> bool

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.

fn has_late_bound_regions(&self) -> bool

True if there are any late-bound regions

fn still_further_specializable(&self) -> bool

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.

fn visit_tys_shallow(&self, visit: impl FnMut(Ty<'tcx>) -> bool) -> bool

A visitor that does not recurse into types, works like fn walk_shallow in Ty.

Loading content...

Implementations on Foreign Types

impl<'tcx> TypeFoldable<'tcx> for GeneratorKind[src]

impl<'tcx, R: Idx, C: Idx> TypeFoldable<'tcx> for BitMatrix<R, C>[src]

impl<'tcx> TypeFoldable<'tcx> for Constness[src]

impl<'tcx> TypeFoldable<'tcx> for ()[src]

impl<'tcx> TypeFoldable<'tcx> for bool[src]

impl<'tcx> TypeFoldable<'tcx> for usize[src]

impl<'tcx> TypeFoldable<'tcx> for VariantIdx[src]

impl<'tcx> TypeFoldable<'tcx> for u32[src]

impl<'tcx> TypeFoldable<'tcx> for u64[src]

impl<'tcx> TypeFoldable<'tcx> for String[src]

impl<'tcx> TypeFoldable<'tcx> for FloatTy[src]

impl<'tcx> TypeFoldable<'tcx> for InlineAsmOptions[src]

impl<'tcx> TypeFoldable<'tcx> for InlineAsmTemplatePiece[src]

impl<'tcx> TypeFoldable<'tcx> for NodeId[src]

impl<'tcx> TypeFoldable<'tcx> for Symbol[src]

impl<'tcx> TypeFoldable<'tcx> for Res[src]

impl<'tcx> TypeFoldable<'tcx> for DefId[src]

impl<'tcx> TypeFoldable<'tcx> for LocalDefId[src]

impl<'tcx> TypeFoldable<'tcx> for HirId[src]

impl<'tcx> TypeFoldable<'tcx> for LlvmInlineAsmInner[src]

impl<'tcx> TypeFoldable<'tcx> for MatchSource[src]

impl<'tcx> TypeFoldable<'tcx> for Unsafety[src]

impl<'tcx> TypeFoldable<'tcx> for InlineAsmRegOrRegClass[src]

impl<'tcx> TypeFoldable<'tcx> for Abi[src]

impl<'tcx> TypeFoldable<'tcx> for Span[src]

impl<'tcx, T: TypeFoldable<'tcx>, U: TypeFoldable<'tcx>> TypeFoldable<'tcx> for (T, U)[src]

impl<'tcx, A: TypeFoldable<'tcx>, B: TypeFoldable<'tcx>, C: TypeFoldable<'tcx>> TypeFoldable<'tcx> for (A, B, C)[src]

impl<'tcx, T> TypeFoldable<'tcx> for Option<T> where
    T: TypeFoldable<'tcx>, 
[src]

impl<'tcx, T, E> TypeFoldable<'tcx> for Result<T, E> where
    T: TypeFoldable<'tcx>,
    E: TypeFoldable<'tcx>, 
[src]

impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for Rc<T>[src]

impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for Arc<T>[src]

impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for Box<T>[src]

impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for Vec<T>[src]

impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for Box<[T]>[src]

impl<'tcx, T: TypeFoldable<'tcx>, I: Idx> TypeFoldable<'tcx> for IndexVec<I, T>[src]

Loading content...

Implementors

impl<'tcx> TypeFoldable<'tcx> for &'tcx AdtDef[src]

AdtDefs are basically the same as a DefId.

impl<'tcx> TypeFoldable<'tcx> for &'tcx Const<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for &'tcx List<ExistentialPredicate<'tcx>>[src]

impl<'tcx> TypeFoldable<'tcx> for &'tcx List<Predicate<'tcx>>[src]

impl<'tcx> TypeFoldable<'tcx> for &'tcx List<PlaceElem<'tcx>>[src]

impl<'tcx> TypeFoldable<'tcx> for &'tcx List<ProjectionKind>[src]

impl<'tcx> TypeFoldable<'tcx> for &'tcx List<Ty<'tcx>>[src]

impl<'tcx> TypeFoldable<'tcx> for CanonicalVarKind[src]

impl<'tcx> TypeFoldable<'tcx> for Certainty[src]

impl<'tcx> TypeFoldable<'tcx> for CoverageKind[src]

impl<'tcx> TypeFoldable<'tcx> for Op[src]

impl<'tcx> TypeFoldable<'tcx> for BindingForm<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for FakeReadCause[src]

impl<'tcx> TypeFoldable<'tcx> for InlineAsmOperand<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for LocalInfo<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for MirPhase[src]

impl<'tcx> TypeFoldable<'tcx> for Operand<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for RetagKind[src]

impl<'tcx> TypeFoldable<'tcx> for Rvalue<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for StatementKind<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for ErrorHandled[src]

impl<'tcx> TypeFoldable<'tcx> for Mutability[src]

impl<'tcx> TypeFoldable<'tcx> for Reveal[src]

impl<'tcx> TypeFoldable<'tcx> for SelectionError<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for OutlivesBound<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for SelectionCandidate<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for Adjust<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for AutoBorrow<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for AutoBorrowMutability[src]

impl<'tcx> TypeFoldable<'tcx> for PointerCast[src]

impl<'tcx> TypeFoldable<'tcx> for BindingMode[src]

impl<'tcx> TypeFoldable<'tcx> for AdtKind[src]

impl<'tcx> TypeFoldable<'tcx> for BoundRegion[src]

impl<'tcx> TypeFoldable<'tcx> for ClosureKind[src]

impl<'tcx> TypeFoldable<'tcx> for ConstKind<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for ExistentialPredicate<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for InferConst<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for InferTy[src]

impl<'tcx> TypeFoldable<'tcx> for InstanceDef<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for IntVarValue[src]

impl<'tcx> TypeFoldable<'tcx> for PredicateAtom<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for PredicateKind<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for UserType<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for Variance[src]

impl<'tcx> TypeFoldable<'tcx> for TypeError<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for CanonicalVarInfo[src]

impl<'tcx> TypeFoldable<'tcx> for CanonicalVarValues<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for QueryRegionConstraints<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for MemberConstraint<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for Scope[src]

impl<'tcx> TypeFoldable<'tcx> for CodeRegion[src]

impl<'tcx> TypeFoldable<'tcx> for CounterValueReference[src]

impl<'tcx> TypeFoldable<'tcx> for ExpressionOperandId[src]

impl<'tcx> TypeFoldable<'tcx> for InjectedExpressionIndex[src]

impl<'tcx> TypeFoldable<'tcx> for MappedExpressionIndex[src]

impl<'tcx> TypeFoldable<'tcx> for GlobalId<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for PredecessorCache[src]

impl<'tcx> TypeFoldable<'tcx> for BasicBlockData<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for BlockTailInfo[src]

impl<'tcx> TypeFoldable<'tcx> for Body<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for Constant<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for Coverage[src]

impl<'tcx> TypeFoldable<'tcx> for Field[src]

impl<'tcx> TypeFoldable<'tcx> for GeneratorLayout<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for GeneratorSavedLocal[src]

impl<'tcx> TypeFoldable<'tcx> for LlvmInlineAsm<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for Local[src]

impl<'tcx> TypeFoldable<'tcx> for LocalDecl<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for MirSource<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for Place<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for Promoted[src]

impl<'tcx> TypeFoldable<'tcx> for SourceInfo[src]

impl<'tcx> TypeFoldable<'tcx> for SourceScope[src]

impl<'tcx> TypeFoldable<'tcx> for SourceScopeData<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for SourceScopeLocalData[src]

impl<'tcx> TypeFoldable<'tcx> for Statement<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for UserTypeProjection[src]

impl<'tcx> TypeFoldable<'tcx> for UserTypeProjections[src]

impl<'tcx> TypeFoldable<'tcx> for VarDebugInfo<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for PlaceTy<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for DropckOutlivesResult<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for NormalizationResult<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for AscribeUserType<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for Eq<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for ProvePredicate<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for Subtype<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for ChalkEnvironmentAndGoal<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for IfExpressionCause[src]

impl<'tcx> TypeFoldable<'tcx> for ImplSourceDiscriminantKindData[src]

impl<'tcx> TypeFoldable<'tcx> for Adjustment<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for OverloadedDeref<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for TraitRefPrintOnlyTraitPath<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for GeneratorWitness<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for AssocItem[src]

impl<'tcx> TypeFoldable<'tcx> for CanonicalUserTypeAnnotation<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for ClosureSubsts<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for ExistentialProjection<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for ExistentialTraitRef<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for FnSig<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for FreeRegion[src]

impl<'tcx> TypeFoldable<'tcx> for GenSig<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for GeneratorSubsts<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for ImplHeader<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for Instance<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for InstantiatedPredicates<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for ParamConst[src]

impl<'tcx> TypeFoldable<'tcx> for ParamEnv<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for ParamTy[src]

impl<'tcx> TypeFoldable<'tcx> for Placeholder<BoundRegion>[src]

impl<'tcx> TypeFoldable<'tcx> for Predicate<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for ProjectionPredicate<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for ProjectionTy<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for RegionVid[src]

impl<'tcx> TypeFoldable<'tcx> for SubtypePredicate<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for TraitPredicate<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for TraitRef<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for TypeAndMut<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for UniverseIndex[src]

impl<'tcx> TypeFoldable<'tcx> for UserTypeAnnotationIndex[src]

impl<'tcx> TypeFoldable<'tcx> for GenericArg<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for UserSelfTy<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for UserSubsts<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for CanonicalVarInfos<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for PlaceElem<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for ProjectionKind[src]

impl<'tcx> TypeFoldable<'tcx> for Region<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for SubstsRef<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx>[src]

impl<'tcx, N> TypeFoldable<'tcx> for ImplSource<'tcx, N> where
    N: TypeFoldable<'tcx>, 
[src]

impl<'tcx, N> TypeFoldable<'tcx> for ImplSourceClosureData<'tcx, N> where
    N: TypeFoldable<'tcx>, 
[src]

impl<'tcx, N> TypeFoldable<'tcx> for ImplSourceFnPointerData<'tcx, N> where
    N: TypeFoldable<'tcx>, 
[src]

impl<'tcx, N> TypeFoldable<'tcx> for ImplSourceGeneratorData<'tcx, N> where
    N: TypeFoldable<'tcx>, 
[src]

impl<'tcx, N> TypeFoldable<'tcx> for ImplSourceObjectData<'tcx, N> where
    N: TypeFoldable<'tcx>, 
[src]

impl<'tcx, N> TypeFoldable<'tcx> for ImplSourceTraitAliasData<'tcx, N> where
    N: TypeFoldable<'tcx>, 
[src]

impl<'tcx, N> TypeFoldable<'tcx> for ImplSourceUserDefinedData<'tcx, N> where
    N: TypeFoldable<'tcx>, 
[src]

impl<'tcx, R> TypeFoldable<'tcx> for QueryResponse<'tcx, R> where
    R: TypeFoldable<'tcx>, 
[src]

impl<'tcx, T> TypeFoldable<'tcx> for ParamEnvAnd<'tcx, T> where
    T: TypeFoldable<'tcx>, 
[src]

impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for Binder<T>[src]

impl<'tcx, V> TypeFoldable<'tcx> for Canonical<'tcx, V> where
    V: TypeFoldable<'tcx>, 
[src]

impl<A, B, 'tcx> TypeFoldable<'tcx> for OutlivesPredicate<A, B> where
    A: TypeFoldable<'tcx>,
    B: TypeFoldable<'tcx>, 
[src]

impl<N, 'tcx> TypeFoldable<'tcx> for ImplSourceAutoImplData<N> where
    N: TypeFoldable<'tcx>, 
[src]

impl<N, 'tcx> TypeFoldable<'tcx> for ImplSourceBuiltinData<N> where
    N: TypeFoldable<'tcx>, 
[src]

impl<T, 'tcx> TypeFoldable<'tcx> for ClearCrossCrate<T> where
    T: TypeFoldable<'tcx>, 
[src]

impl<T, 'tcx> TypeFoldable<'tcx> for Normalize<T> where
    T: TypeFoldable<'tcx>, 
[src]

impl<T, 'tcx> TypeFoldable<'tcx> for ExpectedFound<T> where
    T: TypeFoldable<'tcx>, 
[src]

impl<T, 'tcx> TypeFoldable<'tcx> for WithOptConstParam<T> where
    T: TypeFoldable<'tcx>, 
[src]

Loading content...