Skip to content

Commit af898f7

Browse files
authored
Rollup merge of rust-lang#100085 - RalfJung:op-ty-len, r=oli-obk
interpret: use new OpTy::len for Len rvalue This avoids a `force_allocation`.
2 parents 350cca3 + ea8671e commit af898f7

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)