@@ -154,13 +154,7 @@ impl<'a, 'tcx> InstrumentationVisitor<'a, 'tcx> {
154
154
self . check_operand ( cond) ;
155
155
}
156
156
TerminatorKind :: Drop { place, .. } => {
157
- // According to the documentation, "After drop elaboration: Drop terminators are a
158
- // complete nop for types that have no drop glue. For other types, Drop terminators
159
- // behave exactly like a call to core::mem::drop_in_place with a pointer to the
160
- // given place." Since we check arguments when instrumenting function calls, perhaps
161
- // we need to check that one, too. For more info, see:
162
- // https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/enum.TerminatorKind.html#variant.Drop
163
- self . check_place ( place, PlaceOperation :: Read ) ;
157
+ self . check_place ( place, PlaceOperation :: Deinit ) ;
164
158
}
165
159
TerminatorKind :: Call { func, args, destination, target : _, unwind : _ } => {
166
160
self . check_operand ( func) ;
@@ -221,7 +215,8 @@ impl<'a, 'tcx> InstrumentationVisitor<'a, 'tcx> {
221
215
}
222
216
Operand :: Constant ( _) => {
223
217
// Those should be safe to skip, as they are either constants or statics. In the
224
- // latter case, we handle them in regular uninit visior
218
+ // latter case, we handle them in regular uninit visitor, as accessing statics
219
+ // requires dereferencing a raw pointer.
225
220
}
226
221
}
227
222
}
@@ -237,23 +232,23 @@ impl<'a, 'tcx> InstrumentationVisitor<'a, 'tcx> {
237
232
{
238
233
match place_operation {
239
234
PlaceOperation :: Write => {
240
- // If we are mutating the place, initialize it.
235
+ // Write to the place initializes it.
241
236
self . push_target ( MemoryInitOp :: SetRef {
242
237
operand : Operand :: Copy ( place. clone ( ) ) ,
243
238
value : true ,
244
239
position : InsertPosition :: After ,
245
240
} )
246
241
}
247
242
PlaceOperation :: Deinit => {
248
- // If we are mutating the place, initialize it .
243
+ // Explicitly deinitialie the place.
249
244
self . push_target ( MemoryInitOp :: SetRef {
250
245
operand : Operand :: Copy ( place. clone ( ) ) ,
251
246
value : false ,
252
247
position : InsertPosition :: After ,
253
248
} )
254
249
}
255
250
PlaceOperation :: Read => {
256
- // Otherwise , check its initialization.
251
+ // When reading from a place , check its initialization.
257
252
self . push_target ( MemoryInitOp :: CheckRef {
258
253
operand : Operand :: Copy ( place. clone ( ) ) ,
259
254
} ) ;
0 commit comments