@@ -40,7 +40,7 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch {
4040 let opts_to_apply: Vec < OptimizationToApply < ' tcx > > = bbs_with_switch
4141 . flat_map ( |( bb_idx, bb) | {
4242 let switch = bb. terminator ( ) ;
43- let helper = Helper { body, tcx } ;
43+ let helper = Helper { body } ;
4444 let infos = helper. go ( bb, switch) ?;
4545 Some ( OptimizationToApply { infos, basic_block_first_switch : bb_idx } )
4646 } )
@@ -156,7 +156,6 @@ fn is_switch<'tcx>(terminator: &Terminator<'tcx>) -> bool {
156156
157157struct Helper < ' a , ' tcx > {
158158 body : & ' a Body < ' tcx > ,
159- tcx : TyCtxt < ' tcx > ,
160159}
161160
162161#[ derive( Debug , Clone ) ]
@@ -172,8 +171,6 @@ struct SwitchDiscriminantInfo<'tcx> {
172171 discr_used_in_switch : Place < ' tcx > ,
173172 /// The place of the adt that has its discriminant read
174173 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 > ,
177174}
178175
179176#[ derive( Debug ) ]
@@ -293,16 +290,13 @@ impl<'a, 'tcx> Helper<'a, 'tcx> {
293290 _ => None ,
294291 } ?;
295292
296- let type_adt_matched_on = place_of_adt_discr_read. ty ( self . body , self . tcx ) . ty ;
297-
298293 Some ( SwitchDiscriminantInfo {
299294 discr_used_in_switch : discr. place ( ) ?,
300295 discr_ty,
301296 otherwise_bb,
302297 targets_with_values,
303298 discr_source_info : discr_decl. source_info ,
304299 place_of_adt_discr_read,
305- type_adt_matched_on,
306300 } )
307301 }
308302 _ => unreachable ! ( "must only be passed terminator that is a switch" ) ,
0 commit comments