@@ -294,7 +294,49 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
294
294
) ;
295
295
}
296
296
}
297
- _ => { }
297
+ StatementKind :: CopyNonOverlapping ( box rustc_middle:: mir:: CopyNonOverlapping {
298
+ ref src,
299
+ ref dst,
300
+ ref count,
301
+ } ) => {
302
+ let src_ty = src. ty ( & self . body . local_decls , self . tcx ) ;
303
+ let op_src_ty = if let Some ( src_deref) = src_ty. builtin_deref ( true ) {
304
+ src_deref. ty
305
+ } else {
306
+ self . fail (
307
+ location,
308
+ format ! ( "Expected src to be ptr in copy_nonoverlapping, got: {}" , src_ty) ,
309
+ ) ;
310
+ return ;
311
+ } ;
312
+ let dst_ty = dst. ty ( & self . body . local_decls , self . tcx ) ;
313
+ let op_dst_ty = if let Some ( dst_deref) = dst_ty. builtin_deref ( true ) {
314
+ dst_deref. ty
315
+ } else {
316
+ self . fail (
317
+ location,
318
+ format ! ( "Expected dst to be ptr in copy_nonoverlapping, got: {}" , dst_ty) ,
319
+ ) ;
320
+ return ;
321
+ } ;
322
+ // since CopyNonOverlapping is parametrized by 1 type,
323
+ // we only need to check that they are equal and not keep an extra parameter.
324
+ if op_src_ty != op_dst_ty {
325
+ self . fail ( location, format ! ( "bad arg ({:?} != {:?})" , op_src_ty, op_dst_ty) ) ;
326
+ }
327
+
328
+ let op_cnt_ty = count. ty ( & self . body . local_decls , self . tcx ) ;
329
+ if op_cnt_ty != self . tcx . types . usize {
330
+ self . fail ( location, format ! ( "bad arg ({:?} != usize)" , op_cnt_ty) )
331
+ }
332
+ }
333
+ StatementKind :: SetDiscriminant { .. }
334
+ | StatementKind :: StorageLive ( ..)
335
+ | StatementKind :: StorageDead ( ..)
336
+ | StatementKind :: LlvmInlineAsm ( ..)
337
+ | StatementKind :: Retag ( _, _)
338
+ | StatementKind :: Coverage ( _)
339
+ | StatementKind :: Nop => { }
298
340
}
299
341
300
342
self . super_statement ( statement, location) ;
0 commit comments