@@ -174,6 +174,7 @@ impl MirPass for AddRetag {
174
174
let src_ty = src. ty ( & * local_decls, tcx) ;
175
175
if src_ty. is_region_ptr ( ) {
176
176
// The only `Misc` casts on references are those creating raw pointers.
177
+ let src = src. clone ( ) ;
177
178
assert ! ( dest_ty. is_unsafe_ptr( ) ) ;
178
179
// Insert escape-to-raw before the cast. We are not concerned
179
180
// with stability here: Our EscapeToRaw will not change the value
@@ -184,7 +185,7 @@ impl MirPass for AddRetag {
184
185
let source_info = block_data. statements [ i] . source_info ;
185
186
block_data. statements . insert ( i, Statement {
186
187
source_info,
187
- kind : StatementKind :: EscapeToRaw ( src. clone ( ) ) ,
188
+ kind : StatementKind :: EscapeToRaw ( src) ,
188
189
} ) ;
189
190
}
190
191
}
@@ -194,9 +195,10 @@ impl MirPass for AddRetag {
194
195
StatementKind :: Assign ( ref place, _) if needs_retag ( place) => {
195
196
// Insert a retag after the assignment.
196
197
let source_info = block_data. statements [ i] . source_info ;
198
+ let place = place. clone ( ) ;
197
199
block_data. statements . insert ( i+1 , Statement {
198
200
source_info,
199
- kind : StatementKind :: Retag { fn_entry : false , place : place . clone ( ) } ,
201
+ kind : StatementKind :: Retag { fn_entry : false , place } ,
200
202
} ) ;
201
203
}
202
204
// Do nothing for the rest
0 commit comments