Skip to content

Commit

Permalink
Rollup merge of rust-lang#100085 - RalfJung:op-ty-len, r=oli-obk
Browse files Browse the repository at this point in the history
interpret: use new OpTy::len for Len rvalue

This avoids a `force_allocation`.
  • Loading branch information
JohnTitor authored Aug 30, 2022
2 parents 350cca3 + ea8671e commit af898f7
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 af898f7

Please sign in to comment.