about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/interpret/step.rs
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2023-07-24 11:44:58 +0200
committerRalf Jung <post@ralfj.de>2023-07-25 14:30:58 +0200
commita2bcafa500fa407fa77716ab78b353b7d7daac5d (patch)
tree58e593f4394ea240723c4b6aa69a84b2e6ac437a /compiler/rustc_const_eval/src/interpret/step.rs
parenta593de4fab309968d305f9c6812c2203d4431464 (diff)
downloadrust-a2bcafa500fa407fa77716ab78b353b7d7daac5d.tar.gz
rust-a2bcafa500fa407fa77716ab78b353b7d7daac5d.zip
interpret: refactor projection code to work on a common trait, and use that for visitors
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret/step.rs')
-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 619da8abb7d..319c422134c 100644
--- a/compiler/rustc_const_eval/src/interpret/step.rs
+++ b/compiler/rustc_const_eval/src/interpret/step.rs
@@ -8,7 +8,7 @@ use rustc_middle::mir;
 use rustc_middle::mir::interpret::{InterpResult, Scalar};
 use rustc_middle::ty::layout::LayoutOf;
 
-use super::{ImmTy, InterpCx, Machine};
+use super::{ImmTy, InterpCx, Machine, Projectable};
 use crate::util;
 
 impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
@@ -197,7 +197,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
                     self.get_place_alloc_mut(&dest)?;
                 } else {
                     // Write the src to the first element.
-                    let first = self.mplace_field(&dest, 0)?;
+                    let first = self.project_index(&dest, 0)?;
                     self.copy_op(&src, &first.into(), /*allow_transmute*/ false)?;
 
                     // This is performance-sensitive code for big static/const arrays! So we