about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/mir/interpret
diff options
context:
space:
mode:
authorb-naber <bn263@gmx.de>2022-04-21 19:35:06 +0200
committerb-naber <bn263@gmx.de>2022-04-21 23:11:06 +0200
commitbc698c73e90c253b0d37be8127b3fb542d9e95c2 (patch)
tree14bc8c30dbcf7e6117798bd235a92f0caaaad399 /compiler/rustc_middle/src/mir/interpret
parent28af967bb9165999294250dc3f3a56c2193c35d9 (diff)
downloadrust-bc698c73e90c253b0d37be8127b3fb542d9e95c2.tar.gz
rust-bc698c73e90c253b0d37be8127b3fb542d9e95c2.zip
deduplicate a lot of code
Diffstat (limited to 'compiler/rustc_middle/src/mir/interpret')
-rw-r--r--compiler/rustc_middle/src/mir/interpret/allocation.rs4
-rw-r--r--compiler/rustc_middle/src/mir/interpret/pointer.rs2
2 files changed, 1 insertions, 5 deletions
diff --git a/compiler/rustc_middle/src/mir/interpret/allocation.rs b/compiler/rustc_middle/src/mir/interpret/allocation.rs
index 5e7e362eeef..8cfc5ed0a95 100644
--- a/compiler/rustc_middle/src/mir/interpret/allocation.rs
+++ b/compiler/rustc_middle/src/mir/interpret/allocation.rs
@@ -433,7 +433,6 @@ impl<Tag: Provenance, Extra> Allocation<Tag, Extra> {
                 return self.write_uninit(cx, range);
             }
         };
-        debug!(?val);
 
         // `to_bits_or_ptr_internal` is the right method because we just want to store this data
         // as-is into memory.
@@ -444,16 +443,13 @@ impl<Tag: Provenance, Extra> Allocation<Tag, Extra> {
             }
             Ok(data) => (data, None),
         };
-        debug!(?bytes, ?provenance);
 
         let endian = cx.data_layout().endian;
         let dst = self.get_bytes_mut(cx, range)?;
-        debug!(?dst);
         write_target_uint(endian, dst, bytes).unwrap();
 
         // See if we have to also write a relocation.
         if let Some(provenance) = provenance {
-            debug!("insert relocation for {:?}", provenance);
             self.relocations.0.insert(range.start, provenance);
         }
 
diff --git a/compiler/rustc_middle/src/mir/interpret/pointer.rs b/compiler/rustc_middle/src/mir/interpret/pointer.rs
index cb36e540954..c71aea417ec 100644
--- a/compiler/rustc_middle/src/mir/interpret/pointer.rs
+++ b/compiler/rustc_middle/src/mir/interpret/pointer.rs
@@ -158,7 +158,7 @@ impl Provenance for AllocId {
 #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, TyEncodable, TyDecodable, Hash)]
 #[derive(HashStable)]
 pub struct Pointer<Tag = AllocId> {
-    pub offset: Size, // FIXME This should probably be private
+    pub(super) offset: Size, // kept private to avoid accidental misinterpretation (meaning depends on `Tag` type)
     pub provenance: Tag,
 }