interpret: refactor projection code to work on a common trait, and use that for visitors

This commit is contained in:
Ralf Jung
2023-07-24 11:44:58 +02:00
parent a593de4fab
commit a2bcafa500
44 changed files with 863 additions and 1210 deletions

View File

@@ -425,11 +425,11 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
);
for i in 0..dest_len {
let place = self.mplace_index(&dest, i)?;
let place = self.project_index(&dest, i)?;
let value = if i == index {
elem.clone()
} else {
self.mplace_index(&input, i)?.into()
self.project_index(&input, i)?.into()
};
self.copy_op(&value, &place.into(), /*allow_transmute*/ false)?;
}
@@ -444,7 +444,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
input_len
);
self.copy_op(
&self.mplace_index(&input, index)?.into(),
&self.project_index(&input, index)?.into(),
dest,
/*allow_transmute*/ false,
)?;