@@ -357,18 +357,11 @@ impl MutVisitor<'tcx> for TransformVisitor<'tcx> {
357357 }
358358}
359359
360- fn make_generator_state_argument_indirect < ' tcx > (
361- tcx : TyCtxt < ' tcx > ,
362- def_id : DefId ,
363- body : & mut BodyAndCache < ' tcx > ,
364- ) {
360+ fn make_generator_state_argument_indirect < ' tcx > ( tcx : TyCtxt < ' tcx > , body : & mut BodyAndCache < ' tcx > ) {
365361 let gen_ty = body. local_decls . raw [ 1 ] . ty ;
366362
367- let region = ty:: ReFree ( ty:: FreeRegion { scope : def_id, bound_region : ty:: BoundRegion :: BrEnv } ) ;
368-
369- let region = tcx. mk_region ( region) ;
370-
371- let ref_gen_ty = tcx. mk_ref ( region, ty:: TypeAndMut { ty : gen_ty, mutbl : hir:: Mutability :: Mut } ) ;
363+ let ref_gen_ty =
364+ tcx. mk_ref ( tcx. lifetimes . re_erased , ty:: TypeAndMut { ty : gen_ty, mutbl : Mutability :: Mut } ) ;
372365
373366 // Replace the by value generator argument
374367 body. local_decls . raw [ 1 ] . ty = ref_gen_ty;
@@ -874,7 +867,6 @@ fn elaborate_generator_drops<'tcx>(
874867fn create_generator_drop_shim < ' tcx > (
875868 tcx : TyCtxt < ' tcx > ,
876869 transform : & TransformVisitor < ' tcx > ,
877- def_id : DefId ,
878870 source : MirSource < ' tcx > ,
879871 gen_ty : Ty < ' tcx > ,
880872 body : & mut BodyAndCache < ' tcx > ,
@@ -912,7 +904,7 @@ fn create_generator_drop_shim<'tcx>(
912904 local_info : LocalInfo :: Other ,
913905 } ;
914906
915- make_generator_state_argument_indirect ( tcx, def_id , & mut body) ;
907+ make_generator_state_argument_indirect ( tcx, & mut body) ;
916908
917909 // Change the generator argument from &mut to *mut
918910 body. local_decls [ SELF_ARG ] = LocalDecl {
@@ -1047,7 +1039,6 @@ fn can_unwind<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>) -> bool {
10471039fn create_generator_resume_function < ' tcx > (
10481040 tcx : TyCtxt < ' tcx > ,
10491041 transform : TransformVisitor < ' tcx > ,
1050- def_id : DefId ,
10511042 source : MirSource < ' tcx > ,
10521043 body : & mut BodyAndCache < ' tcx > ,
10531044 can_return : bool ,
@@ -1112,7 +1103,7 @@ fn create_generator_resume_function<'tcx>(
11121103
11131104 insert_switch ( body, cases, & transform, TerminatorKind :: Unreachable ) ;
11141105
1115- make_generator_state_argument_indirect ( tcx, def_id , body) ;
1106+ make_generator_state_argument_indirect ( tcx, body) ;
11161107 make_generator_state_argument_pinned ( tcx, body) ;
11171108
11181109 no_landing_pads ( tcx, body) ;
@@ -1332,11 +1323,11 @@ impl<'tcx> MirPass<'tcx> for StateTransform {
13321323
13331324 // Create a copy of our MIR and use it to create the drop shim for the generator
13341325 let drop_shim =
1335- create_generator_drop_shim ( tcx, & transform, def_id , source, gen_ty, body, drop_clean) ;
1326+ create_generator_drop_shim ( tcx, & transform, source, gen_ty, body, drop_clean) ;
13361327
13371328 body. generator_drop = Some ( box drop_shim) ;
13381329
13391330 // Create the Generator::resume function
1340- create_generator_resume_function ( tcx, transform, def_id , source, body, can_return) ;
1331+ create_generator_resume_function ( tcx, transform, source, body, can_return) ;
13411332 }
13421333}
0 commit comments