@@ -86,7 +86,7 @@ impl MirPhase {
8686}
8787
8888/// The lowered representation of a single function.
89- #[ derive( Clone , RustcEncodable , RustcDecodable , Debug ) ]
89+ #[ derive( Clone , RustcEncodable , RustcDecodable , Debug , TypeFoldable ) ]
9090pub struct Body < ' tcx > {
9191 /// A list of basic blocks. References to basic block use a newtyped index type `BasicBlock`
9292 /// that indexes into this vector.
@@ -446,7 +446,7 @@ impl<'tcx> IndexMut<BasicBlock> for Body<'tcx> {
446446 }
447447}
448448
449- #[ derive( Copy , Clone , Debug , HashStable ) ]
449+ #[ derive( Copy , Clone , Debug , HashStable , TypeFoldable ) ]
450450pub enum ClearCrossCrate < T > {
451451 Clear ,
452452 Set ( T ) ,
@@ -723,7 +723,7 @@ impl_stable_hash_for!(struct BlockTailInfo { tail_result_is_ignored });
723723///
724724/// This can be a binding declared by the user, a temporary inserted by the compiler, a function
725725/// argument, or the return place.
726- #[ derive( Clone , Debug , RustcEncodable , RustcDecodable , HashStable ) ]
726+ #[ derive( Clone , Debug , RustcEncodable , RustcDecodable , HashStable , TypeFoldable ) ]
727727pub struct LocalDecl < ' tcx > {
728728 /// Whether this is a mutable minding (i.e., `let x` or `let mut x`).
729729 ///
@@ -1012,7 +1012,7 @@ impl BasicBlock {
10121012///////////////////////////////////////////////////////////////////////////
10131013// BasicBlockData and Terminator
10141014
1015- #[ derive( Clone , Debug , RustcEncodable , RustcDecodable , HashStable ) ]
1015+ #[ derive( Clone , Debug , RustcEncodable , RustcDecodable , HashStable , TypeFoldable ) ]
10161016pub struct BasicBlockData < ' tcx > {
10171017 /// List of statements in this block.
10181018 pub statements : Vec < Statement < ' tcx > > ,
@@ -1542,7 +1542,7 @@ impl<'tcx> TerminatorKind<'tcx> {
15421542///////////////////////////////////////////////////////////////////////////
15431543// Statements
15441544
1545- #[ derive( Clone , RustcEncodable , RustcDecodable , HashStable ) ]
1545+ #[ derive( Clone , RustcEncodable , RustcDecodable , HashStable , TypeFoldable ) ]
15461546pub struct Statement < ' tcx > {
15471547 pub source_info : SourceInfo ,
15481548 pub kind : StatementKind < ' tcx > ,
@@ -1568,7 +1568,7 @@ impl Statement<'_> {
15681568 }
15691569}
15701570
1571- #[ derive( Clone , Debug , RustcEncodable , RustcDecodable , HashStable ) ]
1571+ #[ derive( Clone , Debug , RustcEncodable , RustcDecodable , HashStable , TypeFoldable ) ]
15721572pub enum StatementKind < ' tcx > {
15731573 /// Write the RHS Rvalue to the LHS Place.
15741574 Assign ( Box < ( Place < ' tcx > , Rvalue < ' tcx > ) > ) ,
@@ -1676,7 +1676,7 @@ pub enum FakeReadCause {
16761676 ForIndex ,
16771677}
16781678
1679- #[ derive( Clone , Debug , RustcEncodable , RustcDecodable , HashStable ) ]
1679+ #[ derive( Clone , Debug , RustcEncodable , RustcDecodable , HashStable , TypeFoldable ) ]
16801680pub struct InlineAsm < ' tcx > {
16811681 pub asm : HirInlineAsm ,
16821682 pub outputs : Box < [ Place < ' tcx > ] > ,
@@ -2418,17 +2418,11 @@ pub struct Constant<'tcx> {
24182418/// The first will lead to the constraint `w: &'1 str` (for some
24192419/// inferred region `'1`). The second will lead to the constraint `w:
24202420/// &'static str`.
2421- #[ derive( Clone , Debug , RustcEncodable , RustcDecodable , HashStable ) ]
2421+ #[ derive( Clone , Debug , RustcEncodable , RustcDecodable , HashStable , TypeFoldable ) ]
24222422pub struct UserTypeProjections {
24232423 pub ( crate ) contents : Vec < ( UserTypeProjection , Span ) > ,
24242424}
24252425
2426- BraceStructTypeFoldableImpl ! {
2427- impl <' tcx> TypeFoldable <' tcx> for UserTypeProjections {
2428- contents
2429- }
2430- }
2431-
24322426impl < ' tcx > UserTypeProjections {
24332427 pub fn none ( ) -> Self {
24342428 UserTypeProjections { contents : vec ! [ ] }
@@ -2737,7 +2731,7 @@ rustc_index::newtype_index! {
27372731}
27382732
27392733/// The layout of generator state.
2740- #[ derive( Clone , Debug , RustcEncodable , RustcDecodable , HashStable ) ]
2734+ #[ derive( Clone , Debug , RustcEncodable , RustcDecodable , HashStable , TypeFoldable ) ]
27412735pub struct GeneratorLayout < ' tcx > {
27422736 /// The type of every local stored inside the generator.
27432737 pub field_tys : IndexVec < GeneratorSavedLocal , Ty < ' tcx > > ,
@@ -2936,92 +2930,6 @@ CloneTypeFoldableAndLiftImpls! {
29362930 UserTypeAnnotationIndex ,
29372931}
29382932
2939- BraceStructTypeFoldableImpl ! {
2940- impl <' tcx> TypeFoldable <' tcx> for Body <' tcx> {
2941- phase,
2942- basic_blocks,
2943- source_scopes,
2944- source_scope_local_data,
2945- yield_ty,
2946- generator_drop,
2947- generator_layout,
2948- local_decls,
2949- user_type_annotations,
2950- arg_count,
2951- __upvar_debuginfo_codegen_only_do_not_use,
2952- spread_arg,
2953- control_flow_destroyed,
2954- span,
2955- cache,
2956- }
2957- }
2958-
2959- BraceStructTypeFoldableImpl ! {
2960- impl <' tcx> TypeFoldable <' tcx> for GeneratorLayout <' tcx> {
2961- field_tys,
2962- variant_fields,
2963- storage_conflicts,
2964- __local_debuginfo_codegen_only_do_not_use,
2965- }
2966- }
2967-
2968- BraceStructTypeFoldableImpl ! {
2969- impl <' tcx> TypeFoldable <' tcx> for LocalDecl <' tcx> {
2970- mutability,
2971- is_user_variable,
2972- internal,
2973- ty,
2974- user_ty,
2975- name,
2976- source_info,
2977- is_block_tail,
2978- visibility_scope,
2979- }
2980- }
2981-
2982- BraceStructTypeFoldableImpl ! {
2983- impl <' tcx> TypeFoldable <' tcx> for BasicBlockData <' tcx> {
2984- statements,
2985- terminator,
2986- is_cleanup,
2987- }
2988- }
2989-
2990- BraceStructTypeFoldableImpl ! {
2991- impl <' tcx> TypeFoldable <' tcx> for Statement <' tcx> {
2992- source_info, kind
2993- }
2994- }
2995-
2996- EnumTypeFoldableImpl ! {
2997- impl <' tcx> TypeFoldable <' tcx> for StatementKind <' tcx> {
2998- ( StatementKind :: Assign ) ( a) ,
2999- ( StatementKind :: FakeRead ) ( cause, place) ,
3000- ( StatementKind :: SetDiscriminant ) { place, variant_index } ,
3001- ( StatementKind :: StorageLive ) ( a) ,
3002- ( StatementKind :: StorageDead ) ( a) ,
3003- ( StatementKind :: InlineAsm ) ( a) ,
3004- ( StatementKind :: Retag ) ( kind, place) ,
3005- ( StatementKind :: AscribeUserType ) ( a, v) ,
3006- ( StatementKind :: Nop ) ,
3007- }
3008- }
3009-
3010- BraceStructTypeFoldableImpl ! {
3011- impl <' tcx> TypeFoldable <' tcx> for InlineAsm <' tcx> {
3012- asm,
3013- outputs,
3014- inputs,
3015- }
3016- }
3017-
3018- EnumTypeFoldableImpl ! {
3019- impl <' tcx, T > TypeFoldable <' tcx> for ClearCrossCrate <T > {
3020- ( ClearCrossCrate :: Clear ) ,
3021- ( ClearCrossCrate :: Set ) ( a) ,
3022- } where T : TypeFoldable <' tcx>
3023- }
3024-
30252933impl < ' tcx > TypeFoldable < ' tcx > for Terminator < ' tcx > {
30262934 fn super_fold_with < F : TypeFolder < ' tcx > > ( & self , folder : & mut F ) -> Self {
30272935 use crate :: mir:: TerminatorKind :: * ;
0 commit comments