about summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
authorAndreas Molzer <andreas.molzer@gmx.de>2019-07-30 23:10:51 +0200
committerAndreas Molzer <andreas.molzer@gmx.de>2019-08-21 10:55:16 +0200
commitd8c5bc7ec6ea2501bdbd2853551aa83175d6e8d0 (patch)
treee718745ef423cb085a7d16039816eab7987854f5 /src/librustc
parent98cff6928925256faffbe3e9ce9f14d0dfdbb6c0 (diff)
downloadrust-d8c5bc7ec6ea2501bdbd2853551aa83175d6e8d0.tar.gz
rust-d8c5bc7ec6ea2501bdbd2853551aa83175d6e8d0.zip
Replace usage of alloc.bytes in interpret
There is now a dedicate `len` method which avoids the need to access the
bytes. Access the length as `Size` can also be done by a direct member.
The constructors guarantee that these representations are convertable.

Access which relies on the bytes, such as snapshot, can use direct raw
access by reference as it does not care about undef and relocations or
properly checks them seperately.
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/mir/interpret/allocation.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs
index e0ada7e2f11..bfbfffeb3b8 100644
--- a/src/librustc/mir/interpret/allocation.rs
+++ b/src/librustc/mir/interpret/allocation.rs
@@ -13,6 +13,8 @@ use rustc_data_structures::sorted_map::SortedMap;
 use rustc_target::abi::HasDataLayout;
 use std::borrow::Cow;
 
+// NOTE: When adding new fields, make sure to adjust the Snapshot impl in
+// `src/librustc_mir/interpret/snapshot.rs`.
 #[derive(
     Clone,
     Debug,