@@ -406,7 +406,7 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, 'tcx, M
406
406
407
407
/// Check if this is a value of primitive type, and if yes check the validity of the value
408
408
/// at that type. Return `true` if the type is indeed primitive.
409
- fn visit_primitive ( & mut self , value : OpTy < ' tcx , M :: PointerTag > ) -> InterpResult < ' tcx , bool > {
409
+ fn try_visit_primitive ( & mut self , value : OpTy < ' tcx , M :: PointerTag > ) -> InterpResult < ' tcx , bool > {
410
410
// Go over all the primitive types
411
411
let ty = value. layout . ty ;
412
412
match ty. kind {
@@ -477,7 +477,7 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, 'tcx, M
477
477
// Nothing to check.
478
478
Ok ( true )
479
479
}
480
- // This should be all the (inhabited) primitive types. The rest is compound, we
480
+ // The above should be all the (inhabited) primitive types. The rest is compound, we
481
481
// check them by visiting their fields/variants.
482
482
// (`Str` UTF-8 check happens in `visit_aggregate`, too.)
483
483
ty:: Adt ( ..)
@@ -489,7 +489,8 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, 'tcx, M
489
489
| ty:: Closure ( ..)
490
490
| ty:: Generator ( ..)
491
491
| ty:: GeneratorWitness ( ..) => Ok ( false ) ,
492
- // Some types only occur during inference, we should not see them here.
492
+ // Some types only occur during typechecking, they have no layout.
493
+ // We should not see them here and we could not check them anyway.
493
494
ty:: Error
494
495
| ty:: Infer ( ..)
495
496
| ty:: Placeholder ( ..)
@@ -618,7 +619,7 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
618
619
trace ! ( "visit_value: {:?}, {:?}" , * op, op. layout) ;
619
620
620
621
// Check primitive types -- the leafs of our recursive descend.
621
- if self . visit_primitive ( op) ? {
622
+ if self . try_visit_primitive ( op) ? {
622
623
return Ok ( ( ) ) ;
623
624
}
624
625
// Sanity check: `builtin_deref` does not know any pointers that are not primitive.
0 commit comments