Skip to content

Commit 290db47

Browse files
committed
comment on keeping validity in sync
1 parent af204b1 commit 290db47

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/librustc_mir/interpret/validity.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
163163
scalar_format(value), path, "a valid unicode codepoint");
164164
},
165165
ty::Float(_) | ty::Int(_) | ty::Uint(_) => {
166+
// NOTE: Keep this in sync with the array optimization for int/float
167+
// types below!
166168
let size = value.layout.size;
167169
let value = value.to_scalar_or_undef();
168170
if const_mode {
@@ -511,6 +513,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
511513
// This is the size in bytes of the whole array.
512514
let size = Size::from_bytes(ty_size * len);
513515

516+
// NOTE: Keep this in sync with the handling of integer and float
517+
// types above, in `validate_primitive_type`.
514518
// In run-time mode, we accept pointers in here. This is actually more
515519
// permissive than a per-element check would be, e.g. we accept
516520
// an &[u8] that contains a pointer even though bytewise checking would

0 commit comments

Comments
 (0)