interpret/validity: improve some comments

This commit is contained in:
Ralf Jung 2022-07-14 19:19:15 -04:00
parent f1a8854f9b
commit 6c6cccdd9b

View File

@ -853,7 +853,8 @@ fn visit_value(&mut self, op: &OpTy<'tcx, M::PointerTag>) -> InterpResult<'tcx>
self.visit_scalar(scalar, scalar_layout)?; self.visit_scalar(scalar, scalar_layout)?;
} }
Abi::ScalarPair(a_layout, b_layout) => { Abi::ScalarPair(a_layout, b_layout) => {
// We would validate these things as we descend into the fields, // There is no `rustc_layout_scalar_valid_range_start` for pairs, so
// we would validate these things as we descend into the fields,
// but that can miss bugs in layout computation. Layout computation // but that can miss bugs in layout computation. Layout computation
// is subtle due to enums having ScalarPair layout, where one field // is subtle due to enums having ScalarPair layout, where one field
// is the discriminant. // is the discriminant.
@ -867,7 +868,8 @@ fn visit_value(&mut self, op: &OpTy<'tcx, M::PointerTag>) -> InterpResult<'tcx>
} }
Abi::Vector { .. } => { Abi::Vector { .. } => {
// No checks here, we assume layout computation gets this right. // No checks here, we assume layout computation gets this right.
// (This is harder to check since Miri does not represent these as `Immediate`.) // (This is harder to check since Miri does not represent these as `Immediate`. We
// also cannot use field projections since this might be a newtype around a vector.)
} }
Abi::Aggregate { .. } => { Abi::Aggregate { .. } => {
// Nothing to do. // Nothing to do.