@@ -128,7 +128,6 @@ enum ExpectedKind {
128128 Reference ,
129129 Box ,
130130 RawPtr ,
131- InitScalar ,
132131 Bool ,
133132 Char ,
134133 Float ,
@@ -143,7 +142,6 @@ impl fmt::Display for ExpectedKind {
143142 ExpectedKind :: Reference => "expected a reference" ,
144143 ExpectedKind :: Box => "expected a box" ,
145144 ExpectedKind :: RawPtr => "expected a raw pointer" ,
146- ExpectedKind :: InitScalar => "expected initialized scalar value" ,
147145 ExpectedKind :: Bool => "expected a boolean" ,
148146 ExpectedKind :: Char => "expected a unicode scalar value" ,
149147 ExpectedKind :: Float => "expected a floating point number" ,
@@ -1478,7 +1476,9 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValueVisitor<'tcx, M> for ValidityVisitor<'rt,
14781476 BackendRepr :: Scalar ( scalar_layout) => {
14791477 if !scalar_layout. is_uninit_valid ( ) {
14801478 // There is something to check here.
1481- let scalar = self . read_scalar ( val, ExpectedKind :: InitScalar ) ?;
1479+ // We read directly via `ecx` since the read cannot fail -- we already read
1480+ // this field above when recursing into the field.
1481+ let scalar = self . ecx . read_scalar ( val) ?;
14821482 self . visit_scalar ( scalar, scalar_layout) ?;
14831483 }
14841484 }
@@ -1487,8 +1487,9 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValueVisitor<'tcx, M> for ValidityVisitor<'rt,
14871487 // FIXME: find a way to also check ScalarPair when one side can be uninit but
14881488 // the other must be init.
14891489 if !a_layout. is_uninit_valid ( ) && !b_layout. is_uninit_valid ( ) {
1490- let ( a, b) =
1491- self . read_immediate ( val, ExpectedKind :: InitScalar ) ?. to_scalar_pair ( ) ;
1490+ // We read directly via `ecx` since the read cannot fail -- we already read
1491+ // this field above when recursing into the field.
1492+ let ( a, b) = self . ecx . read_immediate ( val) ?. to_scalar_pair ( ) ;
14921493 self . visit_scalar ( a, a_layout) ?;
14931494 self . visit_scalar ( b, b_layout) ?;
14941495 }
0 commit comments