about summary refs log tree commit diff
path: root/src/librustc_codegen_ssa
diff options
context:
space:
mode:
authorOliver Scherer <github35764891676564198441@oli-obk.de>2019-06-19 15:58:51 +0200
committerOliver Scherer <github35764891676564198441@oli-obk.de>2019-06-19 15:58:51 +0200
commit23a1ebb3fca8dc77340dd94400255722260991e9 (patch)
treeaf5d49fb4b1329f3b6acd2b9c715b613eacce5d2 /src/librustc_codegen_ssa
parente951d8ec0b9055c333485c0f68024b8371f4fa61 (diff)
downloadrust-23a1ebb3fca8dc77340dd94400255722260991e9.tar.gz
rust-23a1ebb3fca8dc77340dd94400255722260991e9.zip
Remove the `AllocId` from `ByRef` values
`ByRef` const values have no identity beyond their value, we should not treat them as having identity. The `AllocId` often differed between equal constants, because of the way that the miri-engine evaluates constants.
Diffstat (limited to 'src/librustc_codegen_ssa')
-rw-r--r--src/librustc_codegen_ssa/mir/operand.rs4
-rw-r--r--src/librustc_codegen_ssa/mir/place.rs4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/librustc_codegen_ssa/mir/operand.rs b/src/librustc_codegen_ssa/mir/operand.rs
index c1626d31c78..dc288c2f0f3 100644
--- a/src/librustc_codegen_ssa/mir/operand.rs
+++ b/src/librustc_codegen_ssa/mir/operand.rs
@@ -109,8 +109,8 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
                 let b_llval = bx.const_usize((end - start) as u64);
                 OperandValue::Pair(a_llval, b_llval)
             },
-            ConstValue::ByRef(ptr, align, alloc) => {
-                return bx.load_operand(bx.from_const_alloc(layout, align, alloc, ptr.offset));
+            ConstValue::ByRef(offset, align, alloc) => {
+                return bx.load_operand(bx.from_const_alloc(layout, align, alloc, offset));
             },
         };
 
diff --git a/src/librustc_codegen_ssa/mir/place.rs b/src/librustc_codegen_ssa/mir/place.rs
index 72aedb4812a..4993f4559f7 100644
--- a/src/librustc_codegen_ssa/mir/place.rs
+++ b/src/librustc_codegen_ssa/mir/place.rs
@@ -424,8 +424,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                 let layout = cx.layout_of(self.monomorphize(&ty));
                 match bx.tcx().const_eval(param_env.and(cid)) {
                     Ok(val) => match val.val {
-                        mir::interpret::ConstValue::ByRef(ptr, align, alloc) => {
-                            bx.cx().from_const_alloc(layout, align, alloc, ptr.offset)
+                        mir::interpret::ConstValue::ByRef(offset, align, alloc) => {
+                            bx.cx().from_const_alloc(layout, align, alloc, offset)
                         }
                         _ => bug!("promoteds should have an allocation: {:?}", val),
                     },