@@ -31,11 +31,11 @@ pub struct SsaLocals {
31
31
/// We often encounter MIR bodies with 1 or 2 basic blocks. In those cases, it's unnecessary to
32
32
/// actually compute dominators, we can just compare block indices because bb0 is always the first
33
33
/// block, and in any body all other blocks are always dominated by bb0.
34
- struct SmallDominators {
35
- inner : Option < Dominators < BasicBlock > > ,
34
+ struct SmallDominators < ' a > {
35
+ inner : Option < & ' a Dominators < BasicBlock > > ,
36
36
}
37
37
38
- impl SmallDominators {
38
+ impl SmallDominators < ' _ > {
39
39
fn dominates ( & self , first : Location , second : Location ) -> bool {
40
40
if first. block == second. block {
41
41
first. statement_index <= second. statement_index
@@ -68,11 +68,8 @@ impl SsaLocals {
68
68
let assignment_order = Vec :: with_capacity ( body. local_decls . len ( ) ) ;
69
69
70
70
let assignments = IndexVec :: from_elem ( Set1 :: Empty , & body. local_decls ) ;
71
- let dominators = if body. basic_blocks . len ( ) > 2 {
72
- Some ( body. basic_blocks . dominators ( ) . clone ( ) )
73
- } else {
74
- None
75
- } ;
71
+ let dominators =
72
+ if body. basic_blocks . len ( ) > 2 { Some ( body. basic_blocks . dominators ( ) ) } else { None } ;
76
73
let dominators = SmallDominators { inner : dominators } ;
77
74
78
75
let direct_uses = IndexVec :: from_elem ( 0 , & body. local_decls ) ;
@@ -201,14 +198,14 @@ enum LocationExtended {
201
198
Arg ,
202
199
}
203
200
204
- struct SsaVisitor {
205
- dominators : SmallDominators ,
201
+ struct SsaVisitor < ' a > {
202
+ dominators : SmallDominators < ' a > ,
206
203
assignments : IndexVec < Local , Set1 < LocationExtended > > ,
207
204
assignment_order : Vec < Local > ,
208
205
direct_uses : IndexVec < Local , u32 > ,
209
206
}
210
207
211
- impl < ' tcx > Visitor < ' tcx > for SsaVisitor {
208
+ impl < ' tcx > Visitor < ' tcx > for SsaVisitor < ' _ > {
212
209
fn visit_local ( & mut self , local : Local , ctxt : PlaceContext , loc : Location ) {
213
210
match ctxt {
214
211
PlaceContext :: MutatingUse ( MutatingUseContext :: Projection )
0 commit comments