Skip to content

Commit

Permalink
interpret: use new OpTy::len for Len rvalue
Browse files Browse the repository at this point in the history
This avoids a `force_allocation`
  • Loading branch information
RalfJung committed Aug 30, 2022
1 parent 0631ea5 commit ea8671e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_const_eval/src/interpret/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
}

Expand Down

0 comments on commit ea8671e

Please sign in to comment.