]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/interpret/visitor.rs
Rollup merge of #69579 - petrochenkov:noprevspan, r=Centril
[rust.git] / src / librustc_mir / interpret / visitor.rs
index 2cfcf0ff06d0fb2ec6c26fdacb398f09c21073db..d2594e8707104cf10e94f9c3cad066d7f3831fd7 100644 (file)
@@ -223,7 +223,7 @@ fn walk_value(&mut self, v: Self::V) -> InterpResult<'tcx>
                 match v.layout().ty.kind {
                     ty::Dynamic(..) => {
                         // immediate trait objects are not a thing
-                        let dest = v.to_op(self.ecx())?.assert_mem_place();
+                        let dest = v.to_op(self.ecx())?.assert_mem_place(self.ecx());
                         let inner = self.ecx().unpack_dyn_trait(dest)?.1;
                         trace!("walk_value: dyn object layout: {:#?}", inner.layout);
                         // recurse with the inner type
@@ -292,13 +292,7 @@ fn walk_value(&mut self, v: Self::V) -> InterpResult<'tcx>
                     },
                     layout::FieldPlacement::Array { .. } => {
                         // Let's get an mplace first.
-                        let mplace = if v.layout().is_zst() {
-                            // it's a ZST, the memory content cannot matter
-                            MPlaceTy::dangling(v.layout(), self.ecx())
-                        } else {
-                            // non-ZST array/slice/str cannot be immediate
-                            v.to_op(self.ecx())?.assert_mem_place()
-                        };
+                        let mplace = v.to_op(self.ecx())?.assert_mem_place(self.ecx());
                         // Now we can go over all the fields.
                         let iter = self.ecx().mplace_array_fields(mplace)?
                             .map(|f| f.and_then(|f| {