Skip to content

Commit d814d10

Browse files
committed
interpret: use new OpTy::len for Len rvalue
This avoids a `force_allocation`
1 parent 7f442f8 commit d814d10

File tree

1 file changed

+2
-2
lines changed
  • compiler/rustc_const_eval/src/interpret

1 file changed

+2
-2
lines changed

compiler/rustc_const_eval/src/interpret/step.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
251251

252252
Len(place) => {
253253
let src = self.eval_place(place)?;
254-
let mplace = self.force_allocation(&src)?;
255-
let len = mplace.len(self)?;
254+
let op = self.place_to_op(&src)?;
255+
let len = op.len(self)?;
256256
self.write_scalar(Scalar::from_machine_usize(len, self), &dest)?;
257257
}
258258

0 commit comments

Comments
 (0)