]> git.lizzy.rs Git - rust.git/blobdiff - src/shims/foreign_items.rs
Fix merge conflicts
[rust.git] / src / shims / foreign_items.rs
index b28e361b13779606351bbd666464ebf63e9ba555..1933aee1151dc3b3b4cef7b8a5a610ca1ff55b90 100644 (file)
@@ -414,8 +414,8 @@ fn emulate_foreign_item(
             }
 
             "__errno_location" | "__error" => {
-                let errno_scalar: Scalar<Tag> = this.machine.last_error.unwrap().into();
-                this.write_scalar(errno_scalar, dest)?;
+                let errno_place = this.machine.last_error.unwrap();
+                this.write_scalar(errno_place.to_ref().to_scalar()?, dest)?;
             }
 
             "getenv" => {
@@ -977,34 +977,6 @@ fn eval_path_scalar(
         }
         return Ok(None);
     }
-
-    fn set_last_error(&mut self, scalar: Scalar<Tag>) -> InterpResult<'tcx> {
-        let this = self.eval_context_mut();
-        let errno_ptr = this.machine.last_error.unwrap();
-        // We allocated this during machine initialziation so the bounds are fine.
-        this.memory.get_mut(errno_ptr.alloc_id)?.write_scalar(
-            &*this.tcx,
-            errno_ptr,
-            scalar.into(),
-            Size::from_bits(32),
-        )
-    }
-
-    fn get_last_error(&mut self) -> InterpResult<'tcx, Scalar<Tag>> {
-        let this = self.eval_context_mut();
-        let errno_ptr = this.machine.last_error.unwrap();
-        this.memory
-            .get(errno_ptr.alloc_id)?
-            .read_scalar(&*this.tcx, errno_ptr, Size::from_bits(32))?
-            .not_undef()
-    }
-
-    fn consume_io_error(&mut self, e: std::io::Error) -> InterpResult<'tcx> {
-        self.eval_context_mut().set_last_error(Scalar::from_int(
-            e.raw_os_error().unwrap(),
-            Size::from_bits(32),
-        ))
-    }
 }
 
 // Shims the linux 'getrandom()' syscall.