@@ -19,7 +19,7 @@ use rustc_hir as hir;
19
19
use rustc_hir:: def_id:: DefId ;
20
20
use rustc_hir:: { BindingMode , ByRef , HirId , MatchSource , RangeEnd } ;
21
21
use rustc_index:: { IndexVec , newtype_index} ;
22
- use rustc_macros:: { HashStable , TypeVisitable } ;
22
+ use rustc_macros:: { HashStable , TyDecodable , TyEncodable , TypeVisitable } ;
23
23
use rustc_span:: def_id:: LocalDefId ;
24
24
use rustc_span:: { ErrorGuaranteed , Span , Symbol } ;
25
25
use rustc_target:: asm:: InlineAsmRegOrRegClass ;
@@ -52,7 +52,7 @@ macro_rules! thir_with_elements {
52
52
/// A container for a THIR body.
53
53
///
54
54
/// This can be indexed directly by any THIR index (e.g. [`ExprId`]).
55
- #[ derive( Debug , HashStable ) ]
55
+ #[ derive( Debug , HashStable , Clone ) ]
56
56
pub struct Thir <' tcx> {
57
57
pub body_type: BodyTy <' tcx>,
58
58
$(
@@ -90,15 +90,15 @@ thir_with_elements! {
90
90
params: ParamId => Param <' tcx> => "p{}" ,
91
91
}
92
92
93
- #[ derive( Debug , HashStable ) ]
93
+ #[ derive( Debug , HashStable , Clone ) ]
94
94
pub enum BodyTy < ' tcx > {
95
95
Const ( Ty < ' tcx > ) ,
96
96
Fn ( FnSig < ' tcx > ) ,
97
97
GlobalAsm ( Ty < ' tcx > ) ,
98
98
}
99
99
100
100
/// Description of a type-checked function parameter.
101
- #[ derive( Debug , HashStable ) ]
101
+ #[ derive( Clone , Debug , HashStable ) ]
102
102
pub struct Param < ' tcx > {
103
103
/// The pattern that appears in the parameter list, or None for implicit parameters.
104
104
pub pat : Option < Box < Pat < ' tcx > > > ,
@@ -118,7 +118,7 @@ pub enum LintLevel {
118
118
Explicit ( HirId ) ,
119
119
}
120
120
121
- #[ derive( Debug , HashStable ) ]
121
+ #[ derive( Clone , Debug , HashStable ) ]
122
122
pub struct Block {
123
123
/// Whether the block itself has a label. Used by `label: {}`
124
124
/// and `try` blocks.
@@ -138,7 +138,7 @@ pub struct Block {
138
138
139
139
type UserTy < ' tcx > = Option < Box < CanonicalUserType < ' tcx > > > ;
140
140
141
- #[ derive( Debug , HashStable ) ]
141
+ #[ derive( Clone , Debug , HashStable ) ]
142
142
pub struct AdtExpr < ' tcx > {
143
143
/// The ADT we're constructing.
144
144
pub adt_def : AdtDef < ' tcx > ,
@@ -155,7 +155,7 @@ pub struct AdtExpr<'tcx> {
155
155
pub base : AdtExprBase < ' tcx > ,
156
156
}
157
157
158
- #[ derive( Debug , HashStable ) ]
158
+ #[ derive( Clone , Debug , HashStable ) ]
159
159
pub enum AdtExprBase < ' tcx > {
160
160
/// A struct expression where all the fields are explicitly enumerated: `Foo { a, b }`.
161
161
None ,
@@ -168,7 +168,7 @@ pub enum AdtExprBase<'tcx> {
168
168
DefaultFields ( Box < [ Ty < ' tcx > ] > ) ,
169
169
}
170
170
171
- #[ derive( Debug , HashStable ) ]
171
+ #[ derive( Clone , Debug , HashStable ) ]
172
172
pub struct ClosureExpr < ' tcx > {
173
173
pub closure_id : LocalDefId ,
174
174
pub args : UpvarArgs < ' tcx > ,
@@ -177,7 +177,7 @@ pub struct ClosureExpr<'tcx> {
177
177
pub fake_reads : Vec < ( ExprId , FakeReadCause , HirId ) > ,
178
178
}
179
179
180
- #[ derive( Debug , HashStable ) ]
180
+ #[ derive( Clone , Debug , HashStable ) ]
181
181
pub struct InlineAsmExpr < ' tcx > {
182
182
pub asm_macro : AsmMacro ,
183
183
pub template : & ' tcx [ InlineAsmTemplatePiece ] ,
@@ -195,12 +195,12 @@ pub enum BlockSafety {
195
195
ExplicitUnsafe ( HirId ) ,
196
196
}
197
197
198
- #[ derive( Debug , HashStable ) ]
198
+ #[ derive( Clone , Debug , HashStable ) ]
199
199
pub struct Stmt < ' tcx > {
200
200
pub kind : StmtKind < ' tcx > ,
201
201
}
202
202
203
- #[ derive( Debug , HashStable ) ]
203
+ #[ derive( Clone , Debug , HashStable ) ]
204
204
pub enum StmtKind < ' tcx > {
205
205
/// An expression with a trailing semicolon.
206
206
Expr {
@@ -240,11 +240,11 @@ pub enum StmtKind<'tcx> {
240
240
} ,
241
241
}
242
242
243
- #[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash , HashStable ) ]
243
+ #[ derive( Clone , Debug , Copy , PartialEq , Eq , Hash , HashStable , TyEncodable , TyDecodable ) ]
244
244
pub struct LocalVarId ( pub HirId ) ;
245
245
246
246
/// A THIR expression.
247
- #[ derive( Debug , HashStable ) ]
247
+ #[ derive( Clone , Debug , HashStable ) ]
248
248
pub struct Expr < ' tcx > {
249
249
/// kind of expression
250
250
pub kind : ExprKind < ' tcx > ,
@@ -271,7 +271,7 @@ pub struct TempLifetime {
271
271
pub backwards_incompatible : Option < region:: Scope > ,
272
272
}
273
273
274
- #[ derive( Debug , HashStable ) ]
274
+ #[ derive( Clone , Debug , HashStable ) ]
275
275
pub enum ExprKind < ' tcx > {
276
276
/// `Scope`s are used to explicitly mark destruction scopes,
277
277
/// and to track the `HirId` of the expressions within the scope.
@@ -548,20 +548,20 @@ pub enum ExprKind<'tcx> {
548
548
/// Represents the association of a field identifier and an expression.
549
549
///
550
550
/// This is used in struct constructors.
551
- #[ derive( Debug , HashStable ) ]
551
+ #[ derive( Clone , Debug , HashStable ) ]
552
552
pub struct FieldExpr {
553
553
pub name : FieldIdx ,
554
554
pub expr : ExprId ,
555
555
}
556
556
557
- #[ derive( Debug , HashStable ) ]
557
+ #[ derive( Clone , Debug , HashStable ) ]
558
558
pub struct FruInfo < ' tcx > {
559
559
pub base : ExprId ,
560
560
pub field_types : Box < [ Ty < ' tcx > ] > ,
561
561
}
562
562
563
563
/// A `match` arm.
564
- #[ derive( Debug , HashStable ) ]
564
+ #[ derive( Clone , Debug , HashStable ) ]
565
565
pub struct Arm < ' tcx > {
566
566
pub pattern : Box < Pat < ' tcx > > ,
567
567
pub guard : Option < ExprId > ,
@@ -579,7 +579,7 @@ pub enum LogicalOp {
579
579
Or ,
580
580
}
581
581
582
- #[ derive( Debug , HashStable ) ]
582
+ #[ derive( Clone , Debug , HashStable ) ]
583
583
pub enum InlineAsmOperand < ' tcx > {
584
584
In {
585
585
reg : InlineAsmRegOrRegClass ,
@@ -616,13 +616,13 @@ pub enum InlineAsmOperand<'tcx> {
616
616
} ,
617
617
}
618
618
619
- #[ derive( Debug , HashStable , TypeVisitable ) ]
619
+ #[ derive( Clone , Debug , HashStable , TypeVisitable ) ]
620
620
pub struct FieldPat < ' tcx > {
621
621
pub field : FieldIdx ,
622
622
pub pattern : Pat < ' tcx > ,
623
623
}
624
624
625
- #[ derive( Debug , HashStable , TypeVisitable ) ]
625
+ #[ derive( Clone , Debug , HashStable , TypeVisitable ) ]
626
626
pub struct Pat < ' tcx > {
627
627
pub ty : Ty < ' tcx > ,
628
628
pub span : Span ,
@@ -729,7 +729,7 @@ impl<'tcx> Pat<'tcx> {
729
729
}
730
730
}
731
731
732
- #[ derive( Debug , HashStable , TypeVisitable ) ]
732
+ #[ derive( Clone , Debug , HashStable , TypeVisitable ) ]
733
733
pub struct Ascription < ' tcx > {
734
734
pub annotation : CanonicalUserTypeAnnotation < ' tcx > ,
735
735
/// Variance to use when relating the `user_ty` to the **type of the value being
@@ -753,7 +753,7 @@ pub struct Ascription<'tcx> {
753
753
pub variance : ty:: Variance ,
754
754
}
755
755
756
- #[ derive( Debug , HashStable , TypeVisitable ) ]
756
+ #[ derive( Clone , Debug , HashStable , TypeVisitable ) ]
757
757
pub enum PatKind < ' tcx > {
758
758
/// A wildcard pattern: `_`.
759
759
Wild ,
0 commit comments