1
Fork 0

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
No known key found for this signature in database
GPG key ID: 8131A24E0C79EFAF

View file

@ -400,7 +400,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
self.codegen_place_to_pointer(bx, place, mk_ptr) 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 size = self.evaluate_array_len(&mut bx, place);
let operand = OperandRef { let operand = OperandRef {
val: OperandValue::Immediate(size), val: OperandValue::Immediate(size),
@ -537,7 +537,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
} }
} }
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 // ZST are passed as operands and require special handling
// because codegen_place() panics if Local is operand. // because codegen_place() panics if Local is operand.
if let Some(index) = place.as_local() { if let Some(index) = place.as_local() {