about summary refs log tree commit diff
path: root/compiler/rustc_const_eval
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2022-08-02 20:52:15 -0400
committerRalf Jung <post@ralfj.de>2022-08-31 15:22:44 +0200
commitd814d10069122c61d7d275fe6305382703b60448 (patch)
treeb42e171e25c0a6dbcc91f5b7f16f38c9c89cd4c2 /compiler/rustc_const_eval
parent7f442f8ba174fd4233a14ef4d7b577aa907db594 (diff)
interpret: use new OpTy::len for Len rvalue
This avoids a `force_allocation`
Diffstat (limited to 'compiler/rustc_const_eval')
-rw-r--r--compiler/rustc_const_eval/src/interpret/step.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/step.rs b/compiler/rustc_const_eval/src/interpret/step.rs
index 683e11ff7e0..6b827149f50 100644
--- a/compiler/rustc_const_eval/src/interpret/step.rs
+++ b/compiler/rustc_const_eval/src/interpret/step.rs
@@ -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)?;
             }