]> git.lizzy.rs Git - rust.git/commitdiff
Fixup remaining direct relocation field references
authorAndreas Molzer <andreas.molzer@gmx.de>
Fri, 30 Aug 2019 02:19:29 +0000 (04:19 +0200)
committerAndreas Molzer <andreas.molzer@gmx.de>
Fri, 30 Aug 2019 02:19:29 +0000 (04:19 +0200)
src/librustc_codegen_llvm/consts.rs
src/librustc_mir/interpret/snapshot.rs

index 8725e69b11270a8118b5aa0fff8829b5426a3404..958666cb8858a62fa1b71f6119e1fb58db2ea275 100644 (file)
 use std::ffi::{CStr, CString};
 
 pub fn const_alloc_to_llvm(cx: &CodegenCx<'ll, '_>, alloc: &Allocation) -> &'ll Value {
-    let mut llvals = Vec::with_capacity(alloc.relocations.len() + 1);
+    let mut llvals = Vec::with_capacity(alloc.relocations().len() + 1);
     let dl = cx.data_layout();
     let pointer_size = dl.pointer_size.bytes() as usize;
 
     let mut next_offset = 0;
-    for &(offset, ((), alloc_id)) in alloc.relocations.iter() {
+    for &(offset, ((), alloc_id)) in alloc.relocations().iter() {
         let offset = offset.bytes();
         assert_eq!(offset as usize as u64, offset);
         let offset = offset as usize;
@@ -455,7 +455,7 @@ fn codegen_static(
                 //
                 // We could remove this hack whenever we decide to drop macOS 10.10 support.
                 if self.tcx.sess.target.target.options.is_like_osx {
-                    assert_eq!(alloc.relocations.len(), 0);
+                    assert_eq!(alloc.relocations().len(), 0);
 
                     let is_zeroed = {
                         // Treats undefined bytes as if they were defined with the byte value that
@@ -490,7 +490,7 @@ fn codegen_static(
                         section.as_str().as_ptr() as *const _,
                         section.as_str().len() as c_uint,
                     );
-                    assert!(alloc.relocations.is_empty());
+                    assert!(alloc.relocations().is_empty());
 
                     // The `inspect` method is okay here because we checked relocations, and
                     // because we are doing this access to inspect the final interpreter state (not
index 0f0c422d8d3f4668a88724c12c6ad35b117c7698..2cac8bb0c517e49b99a8a20390689f4e61266dd2 100644 (file)
@@ -287,7 +287,6 @@ impl<'a, Ctx> Snapshot<'a, Ctx> for &'a Allocation
 
     fn snapshot(&self, ctx: &'a Ctx) -> Self::Item {
         let Allocation {
-            relocations,
             size,
             align,
             mutability,
@@ -300,7 +299,9 @@ fn snapshot(&self, ctx: &'a Ctx) -> Self::Item {
         // influence interpreter exeuction, but only to detect the error of cycles in evalution
         // dependencies.
         let bytes = self.inspect_with_undef_and_ptr_outside_interpreter(all_bytes);
+
         let undef_mask = self.undef_mask();
+        let relocations = self.relocations();
 
         AllocationSnapshot {
             bytes,