Use Place directly in evaluate_array_len, it's Copy

This commit is contained in:
Santiago Pastorino
2020-03-31 14:37:10 -03:00
parent 1f5338cfd6
commit a865e779b0
+2 -2
View File
@@ -400,7 +400,7 @@ pub fn codegen_rvalue_operand(
self.codegen_place_to_pointer(bx, place, mk_ptr)
}
mir::Rvalue::Len(ref place) => {
mir::Rvalue::Len(place) => {
let size = self.evaluate_array_len(&mut bx, place);
let operand = OperandRef {
val: OperandValue::Immediate(size),
@@ -537,7 +537,7 @@ pub fn codegen_rvalue_operand(
}
}
fn evaluate_array_len(&mut self, bx: &mut Bx, place: &mir::Place<'tcx>) -> Bx::Value {
fn evaluate_array_len(&mut self, bx: &mut Bx, place: mir::Place<'tcx>) -> Bx::Value {
// ZST are passed as operands and require special handling
// because codegen_place() panics if Local is operand.
if let Some(index) = place.as_local() {