From e102c2a3f2d25fdee6793b45b1d12e14f0c16f93 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 9 Sep 2021 15:46:48 -0700 Subject: [PATCH] Fix Windows compilation errors. --- library/std/src/os/windows/io/handle.rs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/library/std/src/os/windows/io/handle.rs b/library/std/src/os/windows/io/handle.rs index 63e332b68096c..b1edc6c511f0e 100644 --- a/library/std/src/os/windows/io/handle.rs +++ b/library/std/src/os/windows/io/handle.rs @@ -4,7 +4,6 @@ use super::raw::{AsRawHandle, FromRawHandle, IntoRawHandle, RawHandle}; use crate::convert::TryFrom; -use crate::ffi::c_void; use crate::fmt; use crate::fs; use crate::marker::PhantomData; @@ -133,7 +132,7 @@ impl TryFrom for OwnedHandle { #[inline] fn try_from(handle_or_null: HandleOrNull) -> Result { let owned_handle = handle_or_null.0; - if owned_handle.handle.as_ptr().is_null() { Err(()) } else { Ok(owned_handle) } + if owned_handle.handle.is_null() { Err(()) } else { Ok(owned_handle) } } } @@ -143,32 +142,28 @@ impl TryFrom for OwnedHandle { #[inline] fn try_from(handle_or_invalid: HandleOrInvalid) -> Result { let owned_handle = handle_or_invalid.0; - if owned_handle.handle.as_ptr() == c::INVALID_HANDLE_VALUE { - Err(()) - } else { - Ok(owned_handle) - } + if owned_handle.handle == c::INVALID_HANDLE_VALUE { Err(()) } else { Ok(owned_handle) } } } impl AsRawHandle for BorrowedHandle<'_> { #[inline] fn as_raw_handle(&self) -> RawHandle { - self.handle.as_ptr() + self.handle } } impl AsRawHandle for OwnedHandle { #[inline] fn as_raw_handle(&self) -> RawHandle { - self.handle.as_ptr() + self.handle } } impl IntoRawHandle for OwnedHandle { #[inline] fn into_raw_handle(self) -> RawHandle { - let handle = self.handle.as_ptr(); + let handle = self.handle; forget(self); handle } @@ -244,7 +239,7 @@ impl Drop for OwnedHandle { #[inline] fn drop(&mut self) { unsafe { - let _ = c::CloseHandle(self.handle.as_ptr()); + let _ = c::CloseHandle(self.handle); } } }