interpret: use new OpTy::len for Len rvalue

This avoids a `force_allocation`
This commit is contained in:
Ralf Jung 2022-08-02 20:52:15 -04:00
parent 7f442f8ba1
commit d814d10069

View File

@ -251,8 +251,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
Len(place) => {
let src = self.eval_place(place)?;
let mplace = self.force_allocation(&src)?;
let len = mplace.len(self)?;
let op = self.place_to_op(&src)?;
let len = op.len(self)?;
self.write_scalar(Scalar::from_machine_usize(len, self), &dest)?;
}