diff options
| author | Mark Simulacrum <mark.simulacrum@gmail.com> | 2016-12-19 18:47:30 -0700 |
|---|---|---|
| committer | Mark Simulacrum <mark.simulacrum@gmail.com> | 2016-12-20 20:04:44 -0700 |
| commit | 295ea0d6c36ce6592be9161f2b5d539cfff236bc (patch) | |
| tree | 6d6ffe2ece5c7c434f5bd96879c99260066a9869 | |
| parent | 98a13ffe443442054b41bee0dace0265c31c29a7 (diff) | |
| download | rust-295ea0d6c36ce6592be9161f2b5d539cfff236bc.tar.gz rust-295ea0d6c36ce6592be9161f2b5d539cfff236bc.zip | |
Reduce coerce_unsized_into to one call
We cannot inline due to it being recursive.
| -rw-r--r-- | src/librustc_trans/mir/rvalue.rs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/librustc_trans/mir/rvalue.rs b/src/librustc_trans/mir/rvalue.rs index 0bca8429d22..a22b0a13f78 100644 --- a/src/librustc_trans/mir/rvalue.rs +++ b/src/librustc_trans/mir/rvalue.rs @@ -69,7 +69,7 @@ impl<'a, 'tcx> MirContext<'a, 'tcx> { // so the (generic) MIR may not be able to expand it. let operand = self.trans_operand(&bcx, source); let operand = operand.pack_if_pair(&bcx); - match operand.val { + let llref = match operand.val { OperandValue::Pair(..) => bug!(), OperandValue::Immediate(llval) => { // unsize from an immediate structure. We don't @@ -81,16 +81,11 @@ impl<'a, 'tcx> MirContext<'a, 'tcx> { debug!("trans_rvalue: creating ugly alloca"); let lltemp = base::alloc_ty(&bcx, operand.ty, "__unsize_temp"); base::store_ty(&bcx, llval, lltemp, operand.ty); - base::coerce_unsized_into(&bcx, - lltemp, operand.ty, - dest.llval, cast_ty); + lltemp } - OperandValue::Ref(llref) => { - base::coerce_unsized_into(&bcx, - llref, operand.ty, - dest.llval, cast_ty); - } - } + OperandValue::Ref(llref) => llref + }; + base::coerce_unsized_into(&bcx, llref, operand.ty, dest.llval, cast_ty); bcx } |
