]> git.lizzy.rs Git - rust.git/commitdiff
the alignment checks on access can no longer fail now
authorRalf Jung <post@ralfj.de>
Sun, 28 Jul 2019 10:29:20 +0000 (12:29 +0200)
committerRalf Jung <post@ralfj.de>
Sun, 28 Jul 2019 10:29:20 +0000 (12:29 +0200)
src/librustc_mir/interpret/operand.rs
src/librustc_mir/interpret/place.rs

index 1816171d7b1276ecbd6f87ac23a2f9f4bbf5cc44..974481a993c67bae2c8665732adf468c17870051 100644 (file)
@@ -238,7 +238,9 @@ fn try_read_immediate_from_mplace(
             return Ok(None);
         }
 
-        let ptr = match self.check_mplace_access(mplace, None)? {
+        let ptr = match self.check_mplace_access(mplace, None)
+            .expect("places should be checked on creation")
+        {
             Some(ptr) => ptr,
             None => return Ok(Some(ImmTy { // zero-sized type
                 imm: Immediate::Scalar(Scalar::zst().into()),
index d0670f64ed8da4faabc815e4bb66680c07284670..1588ed35b13f2bbb7ee5a73363e5b29ecf090a81 100644 (file)
@@ -763,7 +763,9 @@ fn write_immediate_to_mplace_no_validate(
         // to handle padding properly, which is only correct if we never look at this data with the
         // wrong type.
 
-        let ptr = match self.check_mplace_access(dest, None)? {
+        let ptr = match self.check_mplace_access(dest, None)
+            .expect("places should be checked on creation")
+        {
             Some(ptr) => ptr,
             None => return Ok(()), // zero-sized access
         };
@@ -866,8 +868,10 @@ fn copy_op_no_validate(
         });
         assert_eq!(src.meta, dest.meta, "Can only copy between equally-sized instances");
 
-        let src = self.check_mplace_access(src, Some(size))?;
-        let dest = self.check_mplace_access(dest, Some(size))?;
+        let src = self.check_mplace_access(src, Some(size))
+            .expect("places should be checked on creation");
+        let dest = self.check_mplace_access(dest, Some(size))
+            .expect("places should be checked on creation");
         let (src_ptr, dest_ptr) = match (src, dest) {
             (Some(src_ptr), Some(dest_ptr)) => (src_ptr, dest_ptr),
             (None, None) => return Ok(()), // zero-sized copy