@@ -135,7 +135,8 @@ pub type TraitObligation<'tcx> = Obligation<'tcx, ty::PolyTraitPredicate<'tcx>>;
135135static_assert_size ! ( PredicateObligation <' _>, 112 ) ;
136136
137137/// The reason why we incurred this obligation; used for error reporting.
138- #[ derive( Clone , Debug , PartialEq , Eq , Hash , HashStable , RustcEncodable , RustcDecodable ) ]
138+ #[ derive( Clone , Debug , PartialEq , Eq , Hash , HashStable , RustcEncodable , RustcDecodable ,
139+ TypeFoldable ) ]
139140pub struct ObligationCause < ' tcx > {
140141 pub span : Span ,
141142
@@ -165,13 +166,8 @@ impl<'tcx> ObligationCause<'tcx> {
165166 }
166167}
167168
168- BraceStructTypeFoldableImpl ! {
169- impl <' tcx> TypeFoldable <' tcx> for ObligationCause <' tcx> {
170- span, body_id, code
171- }
172- }
173-
174- #[ derive( Clone , Debug , PartialEq , Eq , Hash , HashStable , RustcEncodable , RustcDecodable ) ]
169+ #[ derive( Clone , Debug , PartialEq , Eq , Hash , HashStable , RustcEncodable , RustcDecodable ,
170+ TypeFoldable ) ]
175171pub enum ObligationCauseCode < ' tcx > {
176172 /// Not well classified or should be obvious from the span.
177173 MiscObligation ,
@@ -292,7 +288,8 @@ pub enum ObligationCauseCode<'tcx> {
292288 AssocTypeBound ( Box < AssocTypeBoundData > ) ,
293289}
294290
295- #[ derive( Clone , Debug , PartialEq , Eq , Hash ) ]
291+ #[ derive( Clone , Debug , PartialEq , Eq , Hash , HashStable , RustcEncodable , RustcDecodable ,
292+ TypeFoldable ) ]
296293pub struct AssocTypeBoundData {
297294 pub impl_span : Option < Span > ,
298295 pub original : Span ,
@@ -303,57 +300,8 @@ pub struct AssocTypeBoundData {
303300#[ cfg( target_arch = "x86_64" ) ]
304301static_assert_size ! ( ObligationCauseCode <' _>, 32 ) ;
305302
306- EnumTypeFoldableImpl ! {
307- impl <' tcx> TypeFoldable <' tcx> for ObligationCauseCode <' tcx> {
308- ( ObligationCauseCode :: MiscObligation ) ,
309- ( ObligationCauseCode :: SliceOrArrayElem ) ,
310- ( ObligationCauseCode :: TupleElem ) ,
311- ( ObligationCauseCode :: ProjectionWf ) ( a) ,
312- ( ObligationCauseCode :: ItemObligation ) ( a) ,
313- ( ObligationCauseCode :: BindingObligation ) ( a, b) ,
314- ( ObligationCauseCode :: ReferenceOutlivesReferent ) ( a) ,
315- ( ObligationCauseCode :: ObjectTypeBound ) ( a, b) ,
316- ( ObligationCauseCode :: ObjectCastObligation ) ( a) ,
317- ( ObligationCauseCode :: Coercion ) { source, target} ,
318- ( ObligationCauseCode :: AssignmentLhsSized ) ,
319- ( ObligationCauseCode :: TupleInitializerSized ) ,
320- ( ObligationCauseCode :: StructInitializerSized ) ,
321- ( ObligationCauseCode :: VariableType ) ( a) ,
322- ( ObligationCauseCode :: SizedArgumentType ) ,
323- ( ObligationCauseCode :: SizedReturnType ) ,
324- ( ObligationCauseCode :: SizedYieldType ) ,
325- ( ObligationCauseCode :: RepeatVec ) ,
326- ( ObligationCauseCode :: FieldSized ) { adt_kind, last } ,
327- ( ObligationCauseCode :: ConstSized ) ,
328- ( ObligationCauseCode :: SharedStatic ) ,
329- ( ObligationCauseCode :: BuiltinDerivedObligation ) ( a) ,
330- ( ObligationCauseCode :: ImplDerivedObligation ) ( a) ,
331- ( ObligationCauseCode :: CompareImplMethodObligation ) {
332- item_name,
333- impl_item_def_id,
334- trait_item_def_id
335- } ,
336- ( ObligationCauseCode :: ExprAssignable ) ,
337- ( ObligationCauseCode :: MatchExpressionArm ) ( a) ,
338- ( ObligationCauseCode :: MatchExpressionArmPattern ) {
339- span,
340- ty
341- } ,
342- ( ObligationCauseCode :: IfExpression ) ( a) ,
343- ( ObligationCauseCode :: IfExpressionWithNoElse ) ,
344- ( ObligationCauseCode :: MainFunctionType ) ,
345- ( ObligationCauseCode :: StartFunctionType ) ,
346- ( ObligationCauseCode :: IntrinsicType ) ,
347- ( ObligationCauseCode :: MethodReceiver ) ,
348- ( ObligationCauseCode :: ReturnNoExpression ) ,
349- ( ObligationCauseCode :: ReturnValue ) ( a) ,
350- ( ObligationCauseCode :: ReturnType ) ,
351- ( ObligationCauseCode :: BlockTailExpression ) ( a) ,
352- ( ObligationCauseCode :: TrivialBound ) ,
353- }
354- }
355-
356- #[ derive( Clone , Debug , PartialEq , Eq , Hash , HashStable , RustcEncodable , RustcDecodable ) ]
303+ #[ derive( Clone , Debug , PartialEq , Eq , Hash , HashStable , RustcEncodable , RustcDecodable ,
304+ TypeFoldable ) ]
357305pub struct MatchExpressionArmCause < ' tcx > {
358306 pub arm_span : Span ,
359307 pub source : hir:: MatchSource ,
@@ -362,26 +310,16 @@ pub struct MatchExpressionArmCause<'tcx> {
362310 pub discrim_hir_id : hir:: HirId ,
363311}
364312
365- BraceStructTypeFoldableImpl ! {
366- impl <' tcx> TypeFoldable <' tcx> for MatchExpressionArmCause <' tcx> {
367- arm_span, source, prior_arms, last_ty, discrim_hir_id
368- }
369- }
370-
371- #[ derive( Clone , Debug , PartialEq , Eq , Hash , HashStable , RustcEncodable , RustcDecodable ) ]
313+ #[ derive( Clone , Debug , PartialEq , Eq , Hash , HashStable , RustcEncodable , RustcDecodable ,
314+ TypeFoldable ) ]
372315pub struct IfExpressionCause {
373316 pub then : Span ,
374317 pub outer : Option < Span > ,
375318 pub semicolon : Option < Span > ,
376319}
377320
378- BraceStructTypeFoldableImpl ! {
379- impl <' tcx> TypeFoldable <' tcx> for IfExpressionCause {
380- then, outer, semicolon
381- }
382- }
383-
384- #[ derive( Clone , Debug , PartialEq , Eq , Hash , HashStable , RustcEncodable , RustcDecodable ) ]
321+ #[ derive( Clone , Debug , PartialEq , Eq , Hash , HashStable , RustcEncodable , RustcDecodable ,
322+ TypeFoldable ) ]
385323pub struct DerivedObligationCause < ' tcx > {
386324 /// The trait reference of the parent obligation that led to the
387325 /// current obligation. Note that only trait obligations lead to
@@ -393,13 +331,6 @@ pub struct DerivedObligationCause<'tcx> {
393331 parent_code : Arc < ObligationCauseCode < ' tcx > >
394332}
395333
396- BraceStructTypeFoldableImpl ! {
397- impl <' tcx> TypeFoldable <' tcx> for DerivedObligationCause <' tcx> {
398- parent_trait_ref, parent_code
399- }
400- }
401-
402-
403334pub type Obligations < ' tcx , O > = Vec < Obligation < ' tcx , O > > ;
404335pub type PredicateObligations < ' tcx > = Vec < PredicateObligation < ' tcx > > ;
405336pub type TraitObligations < ' tcx > = Vec < TraitObligation < ' tcx > > ;
0 commit comments