@@ -24,25 +24,29 @@ use std::fmt;
2424use std:: ops:: Index ;
2525
2626newtype_index ! {
27+ #[ derive( HashStable ) ]
2728 pub struct ArmId {
2829 DEBUG_FORMAT = "a{}"
2930 }
3031}
3132
3233newtype_index ! {
34+ #[ derive( HashStable ) ]
3335 pub struct ExprId {
3436 DEBUG_FORMAT = "e{}"
3537 }
3638}
3739
3840newtype_index ! {
41+ #[ derive( HashStable ) ]
3942 pub struct StmtId {
4043 DEBUG_FORMAT = "s{}"
4144 }
4245}
4346
4447macro_rules! thir_with_elements {
4548 ( $( $name: ident: $id: ty => $value: ty, ) * ) => {
49+ #[ derive( Debug , HashStable ) ]
4650 pub struct Thir <' tcx> {
4751 $(
4852 pub $name: IndexVec <$id, $value>,
@@ -76,13 +80,13 @@ thir_with_elements! {
7680 stmts: StmtId => Stmt <' tcx>,
7781}
7882
79- #[ derive( Copy , Clone , Debug ) ]
83+ #[ derive( Copy , Clone , Debug , HashStable ) ]
8084pub enum LintLevel {
8185 Inherited ,
8286 Explicit ( hir:: HirId ) ,
8387}
8488
85- #[ derive( Debug ) ]
89+ #[ derive( Debug , HashStable ) ]
8690pub struct Block {
8791 pub targeted_by_break : bool ,
8892 pub region_scope : region:: Scope ,
@@ -93,21 +97,21 @@ pub struct Block {
9397 pub safety_mode : BlockSafety ,
9498}
9599
96- #[ derive( Copy , Clone , Debug ) ]
100+ #[ derive( Copy , Clone , Debug , HashStable ) ]
97101pub enum BlockSafety {
98102 Safe ,
99103 ExplicitUnsafe ( hir:: HirId ) ,
100104 PushUnsafe ,
101105 PopUnsafe ,
102106}
103107
104- #[ derive( Debug ) ]
108+ #[ derive( Debug , HashStable ) ]
105109pub struct Stmt < ' tcx > {
106110 pub kind : StmtKind < ' tcx > ,
107111 pub opt_destruction_scope : Option < region:: Scope > ,
108112}
109113
110- #[ derive( Debug ) ]
114+ #[ derive( Debug , HashStable ) ]
111115pub enum StmtKind < ' tcx > {
112116 Expr {
113117 /// scope for this statement; may be used as lifetime of temporaries
@@ -157,7 +161,7 @@ rustc_data_structures::static_assert_size!(Expr<'_>, 144);
157161/// MIR simplifications are already done in the impl of `Thir`. For
158162/// example, method calls and overloaded operators are absent: they are
159163/// expected to be converted into `Expr::Call` instances.
160- #[ derive( Debug ) ]
164+ #[ derive( Debug , HashStable ) ]
161165pub struct Expr < ' tcx > {
162166 /// type of this expression
163167 pub ty : Ty < ' tcx > ,
@@ -173,7 +177,7 @@ pub struct Expr<'tcx> {
173177 pub kind : ExprKind < ' tcx > ,
174178}
175179
176- #[ derive( Debug ) ]
180+ #[ derive( Debug , HashStable ) ]
177181pub enum ExprKind < ' tcx > {
178182 Scope {
179183 region_scope : region:: Scope ,
@@ -363,19 +367,19 @@ pub enum ExprKind<'tcx> {
363367 } ,
364368}
365369
366- #[ derive( Debug ) ]
370+ #[ derive( Debug , HashStable ) ]
367371pub struct FieldExpr {
368372 pub name : Field ,
369373 pub expr : ExprId ,
370374}
371375
372- #[ derive( Debug ) ]
376+ #[ derive( Debug , HashStable ) ]
373377pub struct FruInfo < ' tcx > {
374378 pub base : ExprId ,
375379 pub field_types : Box < [ Ty < ' tcx > ] > ,
376380}
377381
378- #[ derive( Debug ) ]
382+ #[ derive( Debug , HashStable ) ]
379383pub struct Arm < ' tcx > {
380384 pub pattern : Pat < ' tcx > ,
381385 pub guard : Option < Guard < ' tcx > > ,
@@ -385,19 +389,19 @@ pub struct Arm<'tcx> {
385389 pub span : Span ,
386390}
387391
388- #[ derive( Debug ) ]
392+ #[ derive( Debug , HashStable ) ]
389393pub enum Guard < ' tcx > {
390394 If ( ExprId ) ,
391395 IfLet ( Pat < ' tcx > , ExprId ) ,
392396}
393397
394- #[ derive( Copy , Clone , Debug ) ]
398+ #[ derive( Copy , Clone , Debug , HashStable ) ]
395399pub enum LogicalOp {
396400 And ,
397401 Or ,
398402}
399403
400- #[ derive( Debug ) ]
404+ #[ derive( Debug , HashStable ) ]
401405pub enum InlineAsmOperand < ' tcx > {
402406 In {
403407 reg : InlineAsmRegOrRegClass ,
@@ -431,19 +435,19 @@ pub enum InlineAsmOperand<'tcx> {
431435 } ,
432436}
433437
434- #[ derive( Copy , Clone , Debug , PartialEq ) ]
438+ #[ derive( Copy , Clone , Debug , PartialEq , HashStable ) ]
435439pub enum BindingMode {
436440 ByValue ,
437441 ByRef ( BorrowKind ) ,
438442}
439443
440- #[ derive( Clone , Debug , PartialEq ) ]
444+ #[ derive( Clone , Debug , PartialEq , HashStable ) ]
441445pub struct FieldPat < ' tcx > {
442446 pub field : Field ,
443447 pub pattern : Pat < ' tcx > ,
444448}
445449
446- #[ derive( Clone , Debug , PartialEq ) ]
450+ #[ derive( Clone , Debug , PartialEq , HashStable ) ]
447451pub struct Pat < ' tcx > {
448452 pub ty : Ty < ' tcx > ,
449453 pub span : Span ,
@@ -456,7 +460,7 @@ impl<'tcx> Pat<'tcx> {
456460 }
457461}
458462
459- #[ derive( Copy , Clone , Debug , PartialEq ) ]
463+ #[ derive( Copy , Clone , Debug , PartialEq , HashStable ) ]
460464pub struct PatTyProj < ' tcx > {
461465 pub user_ty : CanonicalUserType < ' tcx > ,
462466}
@@ -483,7 +487,7 @@ impl<'tcx> PatTyProj<'tcx> {
483487 }
484488}
485489
486- #[ derive( Copy , Clone , Debug , PartialEq ) ]
490+ #[ derive( Copy , Clone , Debug , PartialEq , HashStable ) ]
487491pub struct Ascription < ' tcx > {
488492 pub user_ty : PatTyProj < ' tcx > ,
489493 /// Variance to use when relating the type `user_ty` to the **type of the value being
@@ -508,7 +512,7 @@ pub struct Ascription<'tcx> {
508512 pub user_ty_span : Span ,
509513}
510514
511- #[ derive( Clone , Debug , PartialEq ) ]
515+ #[ derive( Clone , Debug , PartialEq , HashStable ) ]
512516pub enum PatKind < ' tcx > {
513517 Wild ,
514518
@@ -586,7 +590,7 @@ pub enum PatKind<'tcx> {
586590 } ,
587591}
588592
589- #[ derive( Copy , Clone , Debug , PartialEq ) ]
593+ #[ derive( Copy , Clone , Debug , PartialEq , HashStable ) ]
590594pub struct PatRange < ' tcx > {
591595 pub lo : & ' tcx ty:: Const < ' tcx > ,
592596 pub hi : & ' tcx ty:: Const < ' tcx > ,
0 commit comments