about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2018-10-16 08:37:27 +0200
committerRalf Jung <post@ralfj.de>2018-10-18 12:08:22 +0200
commit290db47ad67ee2ef0a43fb4b9b6561d00c4a078e (patch)
tree5a8a2d46ed24bffe0cef6cce2352b0db57f19b0b
parentaf204b1f3e83d77427f5fe78285537378be103ec (diff)
downloadrust-290db47ad67ee2ef0a43fb4b9b6561d00c4a078e.tar.gz
rust-290db47ad67ee2ef0a43fb4b9b6561d00c4a078e.zip
comment on keeping validity in sync
-rw-r--r--src/librustc_mir/interpret/validity.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/librustc_mir/interpret/validity.rs b/src/librustc_mir/interpret/validity.rs
index c446980d049..83b9705c1fe 100644
--- a/src/librustc_mir/interpret/validity.rs
+++ b/src/librustc_mir/interpret/validity.rs
@@ -163,6 +163,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
                     scalar_format(value), path, "a valid unicode codepoint");
             },
             ty::Float(_) | ty::Int(_) | ty::Uint(_) => {
+                // NOTE: Keep this in sync with the array optimization for int/float
+                // types below!
                 let size = value.layout.size;
                 let value = value.to_scalar_or_undef();
                 if const_mode {
@@ -511,6 +513,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
                         // This is the size in bytes of the whole array.
                         let size = Size::from_bytes(ty_size * len);
 
+                        // NOTE: Keep this in sync with the handling of integer and float
+                        // types above, in `validate_primitive_type`.
                         // In run-time mode, we accept pointers in here.  This is actually more
                         // permissive than a per-element check would be, e.g. we accept
                         // an &[u8] that contains a pointer even though bytewise checking would