@@ -40,7 +40,7 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch {
40
40
let opts_to_apply: Vec < OptimizationToApply < ' tcx > > = bbs_with_switch
41
41
. flat_map ( |( bb_idx, bb) | {
42
42
let switch = bb. terminator ( ) ;
43
- let helper = Helper { body, tcx } ;
43
+ let helper = Helper { body } ;
44
44
let infos = helper. go ( bb, switch) ?;
45
45
Some ( OptimizationToApply { infos, basic_block_first_switch : bb_idx } )
46
46
} )
@@ -156,7 +156,6 @@ fn is_switch<'tcx>(terminator: &Terminator<'tcx>) -> bool {
156
156
157
157
struct Helper < ' a , ' tcx > {
158
158
body : & ' a Body < ' tcx > ,
159
- tcx : TyCtxt < ' tcx > ,
160
159
}
161
160
162
161
#[ derive( Debug , Clone ) ]
@@ -172,8 +171,6 @@ struct SwitchDiscriminantInfo<'tcx> {
172
171
discr_used_in_switch : Place < ' tcx > ,
173
172
/// The place of the adt that has its discriminant read
174
173
place_of_adt_discr_read : Place < ' tcx > ,
175
- /// The type of the adt that has its discriminant read
176
- type_adt_matched_on : Ty < ' tcx > ,
177
174
}
178
175
179
176
#[ derive( Debug ) ]
@@ -293,16 +290,13 @@ impl<'a, 'tcx> Helper<'a, 'tcx> {
293
290
_ => None ,
294
291
} ?;
295
292
296
- let type_adt_matched_on = place_of_adt_discr_read. ty ( self . body , self . tcx ) . ty ;
297
-
298
293
Some ( SwitchDiscriminantInfo {
299
294
discr_used_in_switch : discr. place ( ) ?,
300
295
discr_ty,
301
296
otherwise_bb,
302
297
targets_with_values,
303
298
discr_source_info : discr_decl. source_info ,
304
299
place_of_adt_discr_read,
305
- type_adt_matched_on,
306
300
} )
307
301
}
308
302
_ => unreachable ! ( "must only be passed terminator that is a switch" ) ,
0 commit comments