Skip to content

Commit 295ea0d

Browse files
Reduce coerce_unsized_into to one call
We cannot inline due to it being recursive.
1 parent 98a13ff commit 295ea0d

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/librustc_trans/mir/rvalue.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl<'a, 'tcx> MirContext<'a, 'tcx> {
6969
// so the (generic) MIR may not be able to expand it.
7070
let operand = self.trans_operand(&bcx, source);
7171
let operand = operand.pack_if_pair(&bcx);
72-
match operand.val {
72+
let llref = match operand.val {
7373
OperandValue::Pair(..) => bug!(),
7474
OperandValue::Immediate(llval) => {
7575
// unsize from an immediate structure. We don't
@@ -81,16 +81,11 @@ impl<'a, 'tcx> MirContext<'a, 'tcx> {
8181
debug!("trans_rvalue: creating ugly alloca");
8282
let lltemp = base::alloc_ty(&bcx, operand.ty, "__unsize_temp");
8383
base::store_ty(&bcx, llval, lltemp, operand.ty);
84-
base::coerce_unsized_into(&bcx,
85-
lltemp, operand.ty,
86-
dest.llval, cast_ty);
84+
lltemp
8785
}
88-
OperandValue::Ref(llref) => {
89-
base::coerce_unsized_into(&bcx,
90-
llref, operand.ty,
91-
dest.llval, cast_ty);
92-
}
93-
}
86+
OperandValue::Ref(llref) => llref
87+
};
88+
base::coerce_unsized_into(&bcx, llref, operand.ty, dest.llval, cast_ty);
9489
bcx
9590
}
9691

0 commit comments

Comments
 (0)