diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-02-24 05:56:01 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-24 05:56:01 +0100 |
| commit | 1082a292eafef01a24376b82be4dc875e595691e (patch) | |
| tree | ea3bd28ec33ac99a8eef9a88489ae589d56e149e /src/librustc_codegen_ssa | |
| parent | 4dcb7af0e71ea7c6790f225371a055ef707cf0cb (diff) | |
| parent | 1fe7eb00944c3c41059e16daa7b401bc8b04447c (diff) | |
| download | rust-1082a292eafef01a24376b82be4dc875e595691e.tar.gz rust-1082a292eafef01a24376b82be4dc875e595691e.zip | |
Rollup merge of #58511 - oli-obk:const_to_op, r=RalfJung
Const to op simplification r? @RalfJung alternative to https://github.com/rust-lang/rust/pull/58486
Diffstat (limited to 'src/librustc_codegen_ssa')
| -rw-r--r-- | src/librustc_codegen_ssa/mir/operand.rs | 4 | ||||
| -rw-r--r-- | src/librustc_codegen_ssa/mir/place.rs | 4 |
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 2c6d968bb03..3cac1befaf4 100644 --- a/src/librustc_codegen_ssa/mir/operand.rs +++ b/src/librustc_codegen_ssa/mir/operand.rs @@ -101,8 +101,8 @@ impl<'a, 'tcx: 'a, V: CodegenObject> OperandRef<'tcx, V> { let b_llval = bx.cx().const_usize(b); OperandValue::Pair(a_llval, b_llval) }, - ConstValue::ByRef(_, alloc, offset) => { - return Ok(bx.load_operand(bx.cx().from_const_alloc(layout, alloc, offset))); + ConstValue::ByRef(ptr, alloc) => { + return Ok(bx.load_operand(bx.cx().from_const_alloc(layout, alloc, ptr.offset))); }, }; diff --git a/src/librustc_codegen_ssa/mir/place.rs b/src/librustc_codegen_ssa/mir/place.rs index 9d6826d8756..1edcbfead2c 100644 --- a/src/librustc_codegen_ssa/mir/place.rs +++ b/src/librustc_codegen_ssa/mir/place.rs @@ -417,8 +417,8 @@ impl<'a, 'tcx: 'a, 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(_, alloc, offset) => { - bx.cx().from_const_alloc(layout, alloc, offset) + mir::interpret::ConstValue::ByRef(ptr, alloc) => { + bx.cx().from_const_alloc(layout, alloc, ptr.offset) } _ => bug!("promoteds should have an allocation: {:?}", val), }, |
