diff options
| author | Dan Gohman <dev@sunfishcode.online> | 2021-09-09 15:46:48 -0700 |
|---|---|---|
| committer | Josh Stone <jistone@redhat.com> | 2021-11-15 16:25:34 -0800 |
| commit | 2df9cc51285396973f2cb30ba945122467a3ac0c (patch) | |
| tree | 37838b8ba4e83e87bf58d3da58494a9c5ddfe93f | |
| parent | f7acd9ff2f8e2b547e3d820f40635527978f293f (diff) | |
| download | rust-2df9cc51285396973f2cb30ba945122467a3ac0c.tar.gz rust-2df9cc51285396973f2cb30ba945122467a3ac0c.zip | |
Fix Windows compilation errors.
(cherry picked from commit e102c2a3f2d25fdee6793b45b1d12e14f0c16f93)
| -rw-r--r-- | library/std/src/os/windows/io/handle.rs | 17 |
1 files 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 63e332b6809..b1edc6c511f 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<HandleOrNull> for OwnedHandle { #[inline] fn try_from(handle_or_null: HandleOrNull) -> Result<Self, ()> { 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<HandleOrInvalid> for OwnedHandle { #[inline] fn try_from(handle_or_invalid: HandleOrInvalid) -> Result<Self, ()> { 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); } } } |
