Clean up trivial traversal/lift impl generator macro calls.
We have four macros for generating trivial traversal (fold/visit) and lift impls. - `rustc_ir::TrivialTypeTraversalImpls` - `rustc_middle::TrivialTypeTraversalImpls` - `rustc_middle::TrivialLiftImpls` - `rustc_middle::TrivialTypeTraversalAndLiftImpls` The first two are very similar. The last one just combines the second and third one. The macros themselves are ok, but their use is a mess. This commit does the following. - Removes types that no longer need a lift and/or traversal impl from the macro calls. - Consolidates the macro calls into the smallest number of calls possible, with each one mentioning as many types as possible. - Orders the types within those macro calls alphabetically, and makes the module qualification more consistent. - Eliminates `rustc_middle::mir::type_foldable`, because the macro calls were merged and the manual `TypeFoldable` impls are better placed in `structural_impls.rs`, alongside all the other ones. This makes the code more concise. Moving forward, it also makes it more obvious where new types should be added.
This commit is contained in:
parent
e5f11af042
commit
d28678e621
11 changed files with 100 additions and 151 deletions
|
@ -142,10 +142,6 @@ impl<'tcx, R> QueryResponse<'tcx, R> {
|
||||||
pub type QueryOutlivesConstraint<'tcx> =
|
pub type QueryOutlivesConstraint<'tcx> =
|
||||||
(ty::OutlivesPredicate<'tcx, GenericArg<'tcx>>, ConstraintCategory<'tcx>);
|
(ty::OutlivesPredicate<'tcx, GenericArg<'tcx>>, ConstraintCategory<'tcx>);
|
||||||
|
|
||||||
TrivialTypeTraversalImpls! {
|
|
||||||
crate::infer::canonical::Certainty,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct CanonicalParamEnvCache<'tcx> {
|
pub struct CanonicalParamEnvCache<'tcx> {
|
||||||
map: Lock<
|
map: Lock<
|
||||||
|
|
|
@ -163,6 +163,7 @@ impl<'tcx> graph::Predecessors for BasicBlocks<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Done here instead of in `structural_impls.rs` because `Cache` is private, as is `basic_blocks`.
|
||||||
TrivialTypeTraversalImpls! { Cache }
|
TrivialTypeTraversalImpls! { Cache }
|
||||||
|
|
||||||
impl<S: Encoder> Encodable<S> for Cache {
|
impl<S: Encoder> Encodable<S> for Cache {
|
||||||
|
|
|
@ -95,8 +95,6 @@ impl From<ReportedErrorInfo> for ErrorGuaranteed {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TrivialTypeTraversalImpls! { ErrorHandled }
|
|
||||||
|
|
||||||
pub type EvalToAllocationRawResult<'tcx> = Result<ConstAlloc<'tcx>, ErrorHandled>;
|
pub type EvalToAllocationRawResult<'tcx> = Result<ConstAlloc<'tcx>, ErrorHandled>;
|
||||||
pub type EvalStaticInitializerRawResult<'tcx> = Result<ConstAllocation<'tcx>, ErrorHandled>;
|
pub type EvalStaticInitializerRawResult<'tcx> = Result<ConstAllocation<'tcx>, ErrorHandled>;
|
||||||
pub type EvalToConstValueResult<'tcx> = Result<ConstValue<'tcx>, ErrorHandled>;
|
pub type EvalToConstValueResult<'tcx> = Result<ConstValue<'tcx>, ErrorHandled>;
|
||||||
|
|
|
@ -34,7 +34,6 @@ use self::visit::TyContext;
|
||||||
use crate::mir::interpret::{AllocRange, Scalar};
|
use crate::mir::interpret::{AllocRange, Scalar};
|
||||||
use crate::mir::visit::MirVisitable;
|
use crate::mir::visit::MirVisitable;
|
||||||
use crate::ty::codec::{TyDecoder, TyEncoder};
|
use crate::ty::codec::{TyDecoder, TyEncoder};
|
||||||
use crate::ty::fold::{FallibleTypeFolder, TypeFoldable};
|
|
||||||
use crate::ty::print::{FmtPrinter, Printer, pretty_print_const, with_no_trimmed_paths};
|
use crate::ty::print::{FmtPrinter, Printer, pretty_print_const, with_no_trimmed_paths};
|
||||||
use crate::ty::visit::TypeVisitableExt;
|
use crate::ty::visit::TypeVisitableExt;
|
||||||
use crate::ty::{
|
use crate::ty::{
|
||||||
|
@ -59,7 +58,6 @@ pub mod tcx;
|
||||||
mod terminator;
|
mod terminator;
|
||||||
|
|
||||||
pub mod traversal;
|
pub mod traversal;
|
||||||
mod type_foldable;
|
|
||||||
pub mod visit;
|
pub mod visit;
|
||||||
|
|
||||||
pub use consts::*;
|
pub use consts::*;
|
||||||
|
@ -927,8 +925,6 @@ pub enum BindingForm<'tcx> {
|
||||||
RefForGuard,
|
RefForGuard,
|
||||||
}
|
}
|
||||||
|
|
||||||
TrivialTypeTraversalImpls! { BindingForm<'tcx> }
|
|
||||||
|
|
||||||
mod binding_form_impl {
|
mod binding_form_impl {
|
||||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||||
use rustc_query_system::ich::StableHashingContext;
|
use rustc_query_system::ich::StableHashingContext;
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
//! `TypeFoldable` implementations for MIR types
|
|
||||||
|
|
||||||
use rustc_ast::InlineAsmTemplatePiece;
|
|
||||||
use rustc_hir::UnsafeBinderCastKind;
|
|
||||||
use rustc_hir::def_id::LocalDefId;
|
|
||||||
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
TrivialTypeTraversalImpls! {
|
|
||||||
BlockTailInfo,
|
|
||||||
MirPhase,
|
|
||||||
SourceInfo,
|
|
||||||
FakeReadCause,
|
|
||||||
RetagKind,
|
|
||||||
SourceScope,
|
|
||||||
SourceScopeLocalData,
|
|
||||||
UserTypeAnnotationIndex,
|
|
||||||
BorrowKind,
|
|
||||||
RawPtrKind,
|
|
||||||
CastKind,
|
|
||||||
BasicBlock,
|
|
||||||
SwitchTargets,
|
|
||||||
CoroutineKind,
|
|
||||||
CoroutineSavedLocal,
|
|
||||||
UnsafeBinderCastKind,
|
|
||||||
}
|
|
||||||
|
|
||||||
TrivialTypeTraversalImpls! {
|
|
||||||
ConstValue<'tcx>,
|
|
||||||
NullOp<'tcx>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for &'tcx [InlineAsmTemplatePiece] {
|
|
||||||
fn try_fold_with<F: FallibleTypeFolder<TyCtxt<'tcx>>>(
|
|
||||||
self,
|
|
||||||
_folder: &mut F,
|
|
||||||
) -> Result<Self, F::Error> {
|
|
||||||
Ok(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for &'tcx [Span] {
|
|
||||||
fn try_fold_with<F: FallibleTypeFolder<TyCtxt<'tcx>>>(
|
|
||||||
self,
|
|
||||||
_folder: &mut F,
|
|
||||||
) -> Result<Self, F::Error> {
|
|
||||||
Ok(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for &'tcx ty::List<LocalDefId> {
|
|
||||||
fn try_fold_with<F: FallibleTypeFolder<TyCtxt<'tcx>>>(
|
|
||||||
self,
|
|
||||||
_folder: &mut F,
|
|
||||||
) -> Result<Self, F::Error> {
|
|
||||||
Ok(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for &'tcx ty::List<PlaceElem<'tcx>> {
|
|
||||||
fn try_fold_with<F: FallibleTypeFolder<TyCtxt<'tcx>>>(
|
|
||||||
self,
|
|
||||||
folder: &mut F,
|
|
||||||
) -> Result<Self, F::Error> {
|
|
||||||
ty::util::fold_list(self, folder, |tcx, v| tcx.mk_place_elems(v))
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -427,10 +427,6 @@ pub enum IsConstable {
|
||||||
Ctor,
|
Ctor,
|
||||||
}
|
}
|
||||||
|
|
||||||
TrivialTypeTraversalAndLiftImpls! {
|
|
||||||
IsConstable,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The 'location' at which we try to perform HIR-based wf checking.
|
/// The 'location' at which we try to perform HIR-based wf checking.
|
||||||
/// This information is used to obtain an `hir::Ty`, which
|
/// This information is used to obtain an `hir::Ty`, which
|
||||||
/// we can walk in order to obtain precise spans for any
|
/// we can walk in order to obtain precise spans for any
|
||||||
|
|
|
@ -260,8 +260,6 @@ impl From<ErrorGuaranteed> for OverflowError {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TrivialTypeTraversalImpls! { OverflowError }
|
|
||||||
|
|
||||||
impl<'tcx> From<OverflowError> for SelectionError<'tcx> {
|
impl<'tcx> From<OverflowError> for SelectionError<'tcx> {
|
||||||
fn from(overflow_error: OverflowError) -> SelectionError<'tcx> {
|
fn from(overflow_error: OverflowError) -> SelectionError<'tcx> {
|
||||||
match overflow_error {
|
match overflow_error {
|
||||||
|
|
|
@ -30,8 +30,6 @@ impl From<ErrorGuaranteed> for NotConstEvaluatable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TrivialTypeTraversalImpls! { NotConstEvaluatable }
|
|
||||||
|
|
||||||
pub type BoundAbstractConst<'tcx> =
|
pub type BoundAbstractConst<'tcx> =
|
||||||
Result<Option<EarlyBinder<'tcx, ty::Const<'tcx>>>, ErrorGuaranteed>;
|
Result<Option<EarlyBinder<'tcx, ty::Const<'tcx>>>, ErrorGuaranteed>;
|
||||||
|
|
||||||
|
|
|
@ -76,11 +76,11 @@ use crate::traits::solve::{
|
||||||
};
|
};
|
||||||
use crate::ty::predicate::ExistentialPredicateStableCmpExt as _;
|
use crate::ty::predicate::ExistentialPredicateStableCmpExt as _;
|
||||||
use crate::ty::{
|
use crate::ty::{
|
||||||
self, AdtDef, AdtDefData, AdtKind, Binder, BoundConstness, Clause, Clauses, Const, GenericArg,
|
self, AdtDef, AdtDefData, AdtKind, Binder, Clause, Clauses, Const, GenericArg, GenericArgs,
|
||||||
GenericArgs, GenericArgsRef, GenericParamDefKind, ImplPolarity, List, ListWithCachedTypeInfo,
|
GenericArgsRef, GenericParamDefKind, List, ListWithCachedTypeInfo, ParamConst, ParamTy,
|
||||||
ParamConst, ParamTy, Pattern, PatternKind, PolyExistentialPredicate, PolyFnSig, Predicate,
|
Pattern, PatternKind, PolyExistentialPredicate, PolyFnSig, Predicate, PredicateKind,
|
||||||
PredicateKind, PredicatePolarity, Region, RegionKind, ReprOptions, TraitObjectVisitor, Ty,
|
PredicatePolarity, Region, RegionKind, ReprOptions, TraitObjectVisitor, Ty, TyKind, TyVid,
|
||||||
TyKind, TyVid, Visibility,
|
Visibility,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[allow(rustc::usage_of_ty_tykind)]
|
#[allow(rustc::usage_of_ty_tykind)]
|
||||||
|
@ -2279,10 +2279,6 @@ macro_rules! nop_slice_lift {
|
||||||
|
|
||||||
nop_slice_lift! {ty::ValTree<'a> => ty::ValTree<'tcx>}
|
nop_slice_lift! {ty::ValTree<'a> => ty::ValTree<'tcx>}
|
||||||
|
|
||||||
TrivialLiftImpls! {
|
|
||||||
ImplPolarity, PredicatePolarity, Promoted, BoundConstness,
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! sty_debug_print {
|
macro_rules! sty_debug_print {
|
||||||
($fmt: expr, $ctxt: expr, $($variant: ident),*) => {{
|
($fmt: expr, $ctxt: expr, $($variant: ident),*) => {{
|
||||||
// Curious inner module to allow variant names to be used as
|
// Curious inner module to allow variant names to be used as
|
||||||
|
|
|
@ -6,15 +6,18 @@
|
||||||
use std::fmt::{self, Debug};
|
use std::fmt::{self, Debug};
|
||||||
|
|
||||||
use rustc_abi::TyAndLayout;
|
use rustc_abi::TyAndLayout;
|
||||||
|
use rustc_ast::InlineAsmTemplatePiece;
|
||||||
use rustc_ast_ir::try_visit;
|
use rustc_ast_ir::try_visit;
|
||||||
use rustc_ast_ir::visit::VisitorResult;
|
use rustc_ast_ir::visit::VisitorResult;
|
||||||
use rustc_hir::def::Namespace;
|
use rustc_hir::def::Namespace;
|
||||||
|
use rustc_hir::def_id::LocalDefId;
|
||||||
|
use rustc_span::Span;
|
||||||
use rustc_span::source_map::Spanned;
|
use rustc_span::source_map::Spanned;
|
||||||
use rustc_type_ir::ConstKind;
|
use rustc_type_ir::ConstKind;
|
||||||
|
|
||||||
use super::print::PrettyPrinter;
|
use super::print::PrettyPrinter;
|
||||||
use super::{GenericArg, GenericArgKind, Pattern, Region};
|
use super::{GenericArg, GenericArgKind, Pattern, Region};
|
||||||
use crate::mir::interpret;
|
use crate::mir::PlaceElem;
|
||||||
use crate::ty::fold::{FallibleTypeFolder, TypeFoldable, TypeSuperFoldable};
|
use crate::ty::fold::{FallibleTypeFolder, TypeFoldable, TypeSuperFoldable};
|
||||||
use crate::ty::print::{FmtPrinter, Printer, with_no_trimmed_paths};
|
use crate::ty::print::{FmtPrinter, Printer, with_no_trimmed_paths};
|
||||||
use crate::ty::visit::{TypeSuperVisitable, TypeVisitable, TypeVisitor};
|
use crate::ty::visit::{TypeSuperVisitable, TypeVisitable, TypeVisitor};
|
||||||
|
@ -221,76 +224,83 @@ impl<'tcx> fmt::Debug for Region<'tcx> {
|
||||||
// copy...), just add them to one of these lists as appropriate.
|
// copy...), just add them to one of these lists as appropriate.
|
||||||
|
|
||||||
// For things for which the type library provides traversal implementations
|
// For things for which the type library provides traversal implementations
|
||||||
// for all Interners, we only need to provide a Lift implementation:
|
// for all Interners, we only need to provide a Lift implementation.
|
||||||
TrivialLiftImpls! {
|
TrivialLiftImpls! {
|
||||||
(),
|
(),
|
||||||
bool,
|
bool,
|
||||||
usize,
|
usize,
|
||||||
u64,
|
u64,
|
||||||
|
crate::mir::Promoted,
|
||||||
|
crate::mir::interpret::AllocId,
|
||||||
|
crate::mir::interpret::Scalar,
|
||||||
|
rustc_abi::ExternAbi,
|
||||||
|
rustc_abi::Size,
|
||||||
|
rustc_hir::Safety,
|
||||||
|
rustc_type_ir::BoundConstness,
|
||||||
|
rustc_type_ir::PredicatePolarity,
|
||||||
}
|
}
|
||||||
|
|
||||||
// For some things about which the type library does not know, or does not
|
// For some things about which the type library does not know, or does not
|
||||||
// provide any traversal implementations, we need to provide a traversal
|
// provide any traversal implementations, we need to provide a traversal
|
||||||
// implementation (only for TyCtxt<'_> interners).
|
// implementation (only for TyCtxt<'_> interners).
|
||||||
TrivialTypeTraversalImpls! {
|
TrivialTypeTraversalImpls! {
|
||||||
::rustc_abi::FieldIdx,
|
crate::infer::canonical::Certainty,
|
||||||
::rustc_abi::VariantIdx,
|
crate::mir::BasicBlock,
|
||||||
crate::middle::region::Scope,
|
crate::mir::BindingForm<'tcx>,
|
||||||
::rustc_ast::InlineAsmOptions,
|
crate::mir::BlockTailInfo,
|
||||||
::rustc_ast::InlineAsmTemplatePiece,
|
crate::mir::BorrowKind,
|
||||||
::rustc_ast::NodeId,
|
crate::mir::CastKind,
|
||||||
::rustc_hir::def::Res,
|
crate::mir::ConstValue<'tcx>,
|
||||||
::rustc_hir::def_id::LocalDefId,
|
crate::mir::CoroutineSavedLocal,
|
||||||
::rustc_hir::ByRef,
|
crate::mir::FakeReadCause,
|
||||||
::rustc_hir::HirId,
|
|
||||||
::rustc_hir::MatchSource,
|
|
||||||
::rustc_target::asm::InlineAsmRegOrRegClass,
|
|
||||||
crate::mir::coverage::BlockMarkerId,
|
|
||||||
crate::mir::coverage::CounterId,
|
|
||||||
crate::mir::coverage::ExpressionId,
|
|
||||||
crate::mir::coverage::ConditionId,
|
|
||||||
crate::mir::Local,
|
crate::mir::Local,
|
||||||
|
crate::mir::MirPhase,
|
||||||
|
crate::mir::NullOp<'tcx>,
|
||||||
crate::mir::Promoted,
|
crate::mir::Promoted,
|
||||||
crate::ty::adjustment::AutoBorrowMutability,
|
crate::mir::RawPtrKind,
|
||||||
|
crate::mir::RetagKind,
|
||||||
|
crate::mir::SourceInfo,
|
||||||
|
crate::mir::SourceScope,
|
||||||
|
crate::mir::SourceScopeLocalData,
|
||||||
|
crate::mir::SwitchTargets,
|
||||||
|
crate::traits::IsConstable,
|
||||||
|
crate::traits::OverflowError,
|
||||||
crate::ty::AdtKind,
|
crate::ty::AdtKind,
|
||||||
crate::ty::BoundRegion,
|
|
||||||
// Including `BoundRegionKind` is a *bit* dubious, but direct
|
|
||||||
// references to bound region appear in `ty::Error`, and aren't
|
|
||||||
// really meant to be folded. In general, we can only fold a fully
|
|
||||||
// general `Region`.
|
|
||||||
crate::ty::BoundRegionKind,
|
|
||||||
crate::ty::AssocItem,
|
crate::ty::AssocItem,
|
||||||
crate::ty::AssocKind,
|
crate::ty::AssocKind,
|
||||||
|
crate::ty::BoundRegion,
|
||||||
|
crate::ty::BoundVar,
|
||||||
crate::ty::Placeholder<crate::ty::BoundRegion>,
|
crate::ty::Placeholder<crate::ty::BoundRegion>,
|
||||||
crate::ty::Placeholder<crate::ty::BoundTy>,
|
crate::ty::Placeholder<crate::ty::BoundTy>,
|
||||||
crate::ty::Placeholder<ty::BoundVar>,
|
crate::ty::Placeholder<ty::BoundVar>,
|
||||||
crate::ty::LateParamRegion,
|
crate::ty::UserTypeAnnotationIndex,
|
||||||
|
crate::ty::ValTree<'tcx>,
|
||||||
|
crate::ty::abstract_const::NotConstEvaluatable,
|
||||||
|
crate::ty::adjustment::AutoBorrowMutability,
|
||||||
crate::ty::adjustment::PointerCoercion,
|
crate::ty::adjustment::PointerCoercion,
|
||||||
::rustc_span::Ident,
|
rustc_abi::FieldIdx,
|
||||||
::rustc_span::Span,
|
rustc_abi::VariantIdx,
|
||||||
::rustc_span::Symbol,
|
rustc_ast::InlineAsmOptions,
|
||||||
ty::BoundVar,
|
rustc_ast::InlineAsmTemplatePiece,
|
||||||
ty::ValTree<'tcx>,
|
rustc_hir::CoroutineKind,
|
||||||
|
rustc_hir::HirId,
|
||||||
|
rustc_hir::MatchSource,
|
||||||
|
rustc_hir::def_id::LocalDefId,
|
||||||
|
rustc_span::Ident,
|
||||||
|
rustc_span::Span,
|
||||||
|
rustc_span::Symbol,
|
||||||
|
rustc_target::asm::InlineAsmRegOrRegClass,
|
||||||
}
|
}
|
||||||
|
|
||||||
// For some things about which the type library does not know, or does not
|
// For some things about which the type library does not know, or does not
|
||||||
// provide any traversal implementations, we need to provide a traversal
|
// provide any traversal implementations, we need to provide a traversal
|
||||||
// implementation and a lift implementation (the former only for TyCtxt<'_>
|
// implementation and a lift implementation (the former only for TyCtxt<'_>
|
||||||
// interners).
|
// interners).
|
||||||
TrivialTypeTraversalAndLiftImpls! {
|
TrivialTypeTraversalAndLiftImpls! {
|
||||||
::rustc_hir::def_id::DefId,
|
|
||||||
crate::ty::ClosureKind,
|
|
||||||
crate::ty::ParamConst,
|
crate::ty::ParamConst,
|
||||||
crate::ty::ParamTy,
|
crate::ty::ParamTy,
|
||||||
crate::ty::instance::ReifyReason,
|
crate::ty::instance::ReifyReason,
|
||||||
interpret::AllocId,
|
rustc_hir::def_id::DefId,
|
||||||
interpret::CtfeProvenance,
|
|
||||||
interpret::Scalar,
|
|
||||||
rustc_abi::Size,
|
|
||||||
}
|
|
||||||
|
|
||||||
TrivialLiftImpls! {
|
|
||||||
::rustc_hir::Safety,
|
|
||||||
::rustc_abi::ExternAbi,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -672,3 +682,39 @@ impl<'tcx, T: TypeFoldable<TyCtxt<'tcx>> + Debug + Clone> TypeFoldable<TyCtxt<'t
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for &'tcx [InlineAsmTemplatePiece] {
|
||||||
|
fn try_fold_with<F: FallibleTypeFolder<TyCtxt<'tcx>>>(
|
||||||
|
self,
|
||||||
|
_folder: &mut F,
|
||||||
|
) -> Result<Self, F::Error> {
|
||||||
|
Ok(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for &'tcx [Span] {
|
||||||
|
fn try_fold_with<F: FallibleTypeFolder<TyCtxt<'tcx>>>(
|
||||||
|
self,
|
||||||
|
_folder: &mut F,
|
||||||
|
) -> Result<Self, F::Error> {
|
||||||
|
Ok(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for &'tcx ty::List<LocalDefId> {
|
||||||
|
fn try_fold_with<F: FallibleTypeFolder<TyCtxt<'tcx>>>(
|
||||||
|
self,
|
||||||
|
_folder: &mut F,
|
||||||
|
) -> Result<Self, F::Error> {
|
||||||
|
Ok(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for &'tcx ty::List<PlaceElem<'tcx>> {
|
||||||
|
fn try_fold_with<F: FallibleTypeFolder<TyCtxt<'tcx>>>(
|
||||||
|
self,
|
||||||
|
folder: &mut F,
|
||||||
|
) -> Result<Self, F::Error> {
|
||||||
|
ty::util::fold_list(self, folder, |tcx, v| tcx.mk_place_elems(v))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -47,23 +47,14 @@ TrivialTypeTraversalImpls! {
|
||||||
u16,
|
u16,
|
||||||
u32,
|
u32,
|
||||||
u64,
|
u64,
|
||||||
String,
|
|
||||||
crate::AliasRelationDirection,
|
crate::AliasRelationDirection,
|
||||||
crate::AliasTyKind,
|
|
||||||
crate::BoundConstness,
|
crate::BoundConstness,
|
||||||
crate::DebruijnIndex,
|
crate::DebruijnIndex,
|
||||||
crate::FloatTy,
|
|
||||||
crate::InferTy,
|
|
||||||
crate::IntVarValue,
|
|
||||||
crate::PredicatePolarity,
|
crate::PredicatePolarity,
|
||||||
crate::RegionVid,
|
crate::UniverseIndex,
|
||||||
|
crate::Variance,
|
||||||
crate::solve::BuiltinImplSource,
|
crate::solve::BuiltinImplSource,
|
||||||
crate::solve::Certainty,
|
crate::solve::Certainty,
|
||||||
crate::solve::GoalSource,
|
crate::solve::GoalSource,
|
||||||
crate::solve::MaybeCause,
|
|
||||||
crate::solve::NoSolution,
|
|
||||||
crate::UniverseIndex,
|
|
||||||
crate::Variance,
|
|
||||||
rustc_ast_ir::Movability,
|
|
||||||
rustc_ast_ir::Mutability,
|
rustc_ast_ir::Mutability,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue