@@ -126,14 +126,14 @@ fn self_arg() -> Local {
126
126
Local :: new ( 1 )
127
127
}
128
128
129
- struct SuspensionPoint < V : Idx > {
129
+ struct SuspensionPoint {
130
130
state : u32 ,
131
131
resume : BasicBlock ,
132
132
drop : Option < BasicBlock > ,
133
- storage_liveness : liveness:: LocalSet < V > ,
133
+ storage_liveness : liveness:: LocalSet < Local > ,
134
134
}
135
135
136
- struct TransformVisitor < ' a , ' tcx : ' a , V : Idx > {
136
+ struct TransformVisitor < ' a , ' tcx : ' a > {
137
137
tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
138
138
state_adt_ref : & ' tcx AdtDef ,
139
139
state_substs : & ' tcx Substs < ' tcx > ,
@@ -145,16 +145,16 @@ struct TransformVisitor<'a, 'tcx: 'a, V: Idx> {
145
145
remap : HashMap < Local , ( Ty < ' tcx > , usize ) > ,
146
146
147
147
// A map from a suspension point in a block to the locals which have live storage at that point
148
- storage_liveness : HashMap < BasicBlock , liveness:: LocalSet < V > > ,
148
+ storage_liveness : HashMap < BasicBlock , liveness:: LocalSet < Local > > ,
149
149
150
150
// A list of suspension points, generated during the transform
151
- suspension_points : Vec < SuspensionPoint < V > > ,
151
+ suspension_points : Vec < SuspensionPoint > ,
152
152
153
153
// The original RETURN_PLACE local
154
154
new_ret_local : Local ,
155
155
}
156
156
157
- impl < ' a , ' tcx , V : Idx > TransformVisitor < ' a , ' tcx , V > {
157
+ impl < ' a , ' tcx > TransformVisitor < ' a , ' tcx > {
158
158
// Make a GeneratorState rvalue
159
159
fn make_state ( & self , idx : usize , val : Operand < ' tcx > ) -> Rvalue < ' tcx > {
160
160
let adt = AggregateKind :: Adt ( self . state_adt_ref , idx, self . state_substs , None ) ;
@@ -191,7 +191,7 @@ impl<'a, 'tcx, V: Idx> TransformVisitor<'a, 'tcx, V> {
191
191
}
192
192
}
193
193
194
- impl < ' a , ' tcx , V : Idx > MutVisitor < ' tcx > for TransformVisitor < ' a , ' tcx , V > {
194
+ impl < ' a , ' tcx > MutVisitor < ' tcx > for TransformVisitor < ' a , ' tcx > {
195
195
fn visit_local ( & mut self ,
196
196
local : & mut Local ,
197
197
_: PlaceContext < ' tcx > ,
@@ -317,9 +317,9 @@ fn replace_result_variable<'tcx>(ret_ty: Ty<'tcx>,
317
317
new_ret_local
318
318
}
319
319
320
- struct StorageIgnored < V : Idx > ( liveness:: LocalSet < V > ) ;
320
+ struct StorageIgnored ( liveness:: LocalSet < Local > ) ;
321
321
322
- impl < ' tcx , V : Idx > Visitor < ' tcx > for StorageIgnored < V > {
322
+ impl < ' tcx > Visitor < ' tcx > for StorageIgnored {
323
323
fn visit_statement ( & mut self ,
324
324
_block : BasicBlock ,
325
325
statement : & Statement < ' tcx > ,
@@ -332,9 +332,9 @@ impl<'tcx, V: Idx> Visitor<'tcx> for StorageIgnored<V> {
332
332
}
333
333
}
334
334
335
- struct BorrowedLocals < V : Idx > ( liveness:: LocalSet < V > ) ;
335
+ struct BorrowedLocals ( liveness:: LocalSet < Local > ) ;
336
336
337
- fn mark_as_borrowed < ' tcx , V : Idx > ( place : & Place < ' tcx > , locals : & mut BorrowedLocals < V > ) {
337
+ fn mark_as_borrowed < ' tcx , V : Idx > ( place : & Place < ' tcx > , locals : & mut BorrowedLocals ) {
338
338
match * place {
339
339
Place :: Local ( l) => { locals. 0 . add ( & l) ; } ,
340
340
Place :: Static ( ..) => ( ) ,
@@ -349,7 +349,7 @@ fn mark_as_borrowed<'tcx, V: Idx>(place: &Place<'tcx>, locals: &mut BorrowedLoca
349
349
}
350
350
}
351
351
352
- impl < ' tcx , V : Idx > Visitor < ' tcx > for BorrowedLocals < V > {
352
+ impl < ' tcx > Visitor < ' tcx > for BorrowedLocals {
353
353
fn visit_rvalue ( & mut self ,
354
354
rvalue : & Rvalue < ' tcx > ,
355
355
location : Location ) {
@@ -361,12 +361,12 @@ impl<'tcx, V: Idx> Visitor<'tcx> for BorrowedLocals<V> {
361
361
}
362
362
}
363
363
364
- fn locals_live_across_suspend_points < ' a , ' tcx , V : Idx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
364
+ fn locals_live_across_suspend_points < ' a , ' tcx , > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
365
365
mir : & Mir < ' tcx > ,
366
366
source : MirSource ,
367
367
movable : bool ) ->
368
- ( liveness:: LocalSet < V > ,
369
- HashMap < BasicBlock , liveness:: LocalSet < V > > ) {
368
+ ( liveness:: LocalSet < Local > ,
369
+ HashMap < BasicBlock , liveness:: LocalSet < Local > > ) {
370
370
let dead_unwinds = IdxSetBuf :: new_empty ( mir. basic_blocks ( ) . len ( ) ) ;
371
371
let node_id = tcx. hir . as_local_node_id ( source. def_id ) . unwrap ( ) ;
372
372
@@ -460,15 +460,15 @@ fn locals_live_across_suspend_points<'a, 'tcx, V: Idx>(tcx: TyCtxt<'a, 'tcx, 'tc
460
460
( set, storage_liveness_map)
461
461
}
462
462
463
- fn compute_layout < ' a , ' tcx , V : Idx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
463
+ fn compute_layout < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
464
464
source : MirSource ,
465
465
upvars : Vec < Ty < ' tcx > > ,
466
466
interior : Ty < ' tcx > ,
467
467
movable : bool ,
468
468
mir : & mut Mir < ' tcx > )
469
469
-> ( HashMap < Local , ( Ty < ' tcx > , usize ) > ,
470
470
GeneratorLayout < ' tcx > ,
471
- HashMap < BasicBlock , liveness:: LocalSet < V > > )
471
+ HashMap < BasicBlock , liveness:: LocalSet < Local > > )
472
472
{
473
473
// Use a liveness analysis to compute locals which are live across a suspension point
474
474
let ( live_locals, storage_liveness) = locals_live_across_suspend_points ( tcx,
@@ -524,10 +524,10 @@ fn compute_layout<'a, 'tcx, V: Idx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
524
524
( remap, layout, storage_liveness)
525
525
}
526
526
527
- fn insert_switch < ' a , ' tcx , V : Idx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
527
+ fn insert_switch < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
528
528
mir : & mut Mir < ' tcx > ,
529
529
cases : Vec < ( u32 , BasicBlock ) > ,
530
- transform : & TransformVisitor < ' a , ' tcx , V > ,
530
+ transform : & TransformVisitor < ' a , ' tcx > ,
531
531
default : TerminatorKind < ' tcx > ) {
532
532
let default_block = insert_term_block ( mir, default) ;
533
533
@@ -608,9 +608,9 @@ fn elaborate_generator_drops<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
608
608
}
609
609
}
610
610
611
- fn create_generator_drop_shim < ' a , ' tcx , V : Idx > (
611
+ fn create_generator_drop_shim < ' a , ' tcx > (
612
612
tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
613
- transform : & TransformVisitor < ' a , ' tcx , V > ,
613
+ transform : & TransformVisitor < ' a , ' tcx > ,
614
614
def_id : DefId ,
615
615
source : MirSource ,
616
616
gen_ty : Ty < ' tcx > ,
@@ -719,9 +719,9 @@ fn insert_panic_block<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
719
719
assert_block
720
720
}
721
721
722
- fn create_generator_resume_function < ' a , ' tcx , V : Idx > (
722
+ fn create_generator_resume_function < ' a , ' tcx > (
723
723
tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
724
- transform : TransformVisitor < ' a , ' tcx , V > ,
724
+ transform : TransformVisitor < ' a , ' tcx > ,
725
725
def_id : DefId ,
726
726
source : MirSource ,
727
727
mir : & mut Mir < ' tcx > ) {
@@ -790,10 +790,10 @@ fn insert_clean_drop<'a, 'tcx>(mir: &mut Mir<'tcx>) -> BasicBlock {
790
790
drop_clean
791
791
}
792
792
793
- fn create_cases < ' a , ' tcx , F , V : Idx > ( mir : & mut Mir < ' tcx > ,
794
- transform : & TransformVisitor < ' a , ' tcx , V > ,
793
+ fn create_cases < ' a , ' tcx , F > ( mir : & mut Mir < ' tcx > ,
794
+ transform : & TransformVisitor < ' a , ' tcx > ,
795
795
target : F ) -> Vec < ( u32 , BasicBlock ) >
796
- where F : Fn ( & SuspensionPoint < V > ) -> Option < BasicBlock > {
796
+ where F : Fn ( & SuspensionPoint ) -> Option < BasicBlock > {
797
797
let source_info = source_info ( mir) ;
798
798
799
799
transform. suspension_points . iter ( ) . filter_map ( |point| {
0 commit comments