@@ -406,7 +406,7 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, 'tcx, M
406406
407407 /// Check if this is a value of primitive type, and if yes check the validity of the value
408408 /// 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 > {
410410 // Go over all the primitive types
411411 let ty = value. layout . ty ;
412412 match ty. kind {
@@ -477,7 +477,7 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, 'tcx, M
477477 // Nothing to check.
478478 Ok ( true )
479479 }
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
481481 // check them by visiting their fields/variants.
482482 // (`Str` UTF-8 check happens in `visit_aggregate`, too.)
483483 ty:: Adt ( ..)
@@ -489,7 +489,8 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, 'tcx, M
489489 | ty:: Closure ( ..)
490490 | ty:: Generator ( ..)
491491 | 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.
493494 ty:: Error
494495 | ty:: Infer ( ..)
495496 | ty:: Placeholder ( ..)
@@ -618,7 +619,7 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
618619 trace ! ( "visit_value: {:?}, {:?}" , * op, op. layout) ;
619620
620621 // Check primitive types -- the leafs of our recursive descend.
621- if self . visit_primitive ( op) ? {
622+ if self . try_visit_primitive ( op) ? {
622623 return Ok ( ( ) ) ;
623624 }
624625 // Sanity check: `builtin_deref` does not know any pointers that are not primitive.
0 commit comments