@@ -8,13 +8,13 @@ use rustc_middle::ty::TyCtxt;
8
8
9
9
pub struct Derefer ;
10
10
11
- pub struct DerefChecker < ' tcx > {
11
+ pub struct DerefChecker < ' a , ' tcx > {
12
12
tcx : TyCtxt < ' tcx > ,
13
13
patcher : MirPatch < ' tcx > ,
14
- local_decls : IndexVec < Local , LocalDecl < ' tcx > > ,
14
+ local_decls : & ' a IndexVec < Local , LocalDecl < ' tcx > > ,
15
15
}
16
16
17
- impl < ' tcx > MutVisitor < ' tcx > for DerefChecker < ' tcx > {
17
+ impl < ' a , ' tcx > MutVisitor < ' tcx > for DerefChecker < ' a , ' tcx > {
18
18
fn tcx ( & self ) -> TyCtxt < ' tcx > {
19
19
self . tcx
20
20
}
@@ -36,7 +36,7 @@ impl<'tcx> MutVisitor<'tcx> for DerefChecker<'tcx> {
36
36
37
37
for ( idx, ( p_ref, p_elem) ) in place. iter_projections ( ) . enumerate ( ) {
38
38
if !p_ref. projection . is_empty ( ) && p_elem == ProjectionElem :: Deref {
39
- let ty = p_ref. ty ( & self . local_decls , self . tcx ) . ty ;
39
+ let ty = p_ref. ty ( self . local_decls , self . tcx ) . ty ;
40
40
let temp = self . patcher . new_internal_with_info (
41
41
ty,
42
42
self . local_decls [ p_ref. local ] . source_info . span ,
@@ -70,7 +70,7 @@ impl<'tcx> MutVisitor<'tcx> for DerefChecker<'tcx> {
70
70
71
71
pub fn deref_finder < ' tcx > ( tcx : TyCtxt < ' tcx > , body : & mut Body < ' tcx > ) {
72
72
let patch = MirPatch :: new ( body) ;
73
- let mut checker = DerefChecker { tcx, patcher : patch, local_decls : body. local_decls . clone ( ) } ;
73
+ let mut checker = DerefChecker { tcx, patcher : patch, local_decls : & body. local_decls } ;
74
74
75
75
for ( bb, data) in body. basic_blocks . as_mut_preserves_cfg ( ) . iter_enumerated_mut ( ) {
76
76
checker. visit_basic_block_data ( bb, data) ;
0 commit comments