Skip to content

Commit 6c6cccd

Browse files
committed
interpret/validity: improve some comments
1 parent f1a8854 commit 6c6cccd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler/rustc_const_eval/src/interpret/validity.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,8 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
853853
self.visit_scalar(scalar, scalar_layout)?;
854854
}
855855
Abi::ScalarPair(a_layout, b_layout) => {
856-
// We would validate these things as we descend into the fields,
856+
// There is no `rustc_layout_scalar_valid_range_start` for pairs, so
857+
// we would validate these things as we descend into the fields,
857858
// but that can miss bugs in layout computation. Layout computation
858859
// is subtle due to enums having ScalarPair layout, where one field
859860
// is the discriminant.
@@ -867,7 +868,8 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
867868
}
868869
Abi::Vector { .. } => {
869870
// No checks here, we assume layout computation gets this right.
870-
// (This is harder to check since Miri does not represent these as `Immediate`.)
871+
// (This is harder to check since Miri does not represent these as `Immediate`. We
872+
// also cannot use field projections since this might be a newtype around a vector.)
871873
}
872874
Abi::Aggregate { .. } => {
873875
// Nothing to do.

0 commit comments

Comments
 (0)