From 0cd81fcbb3db53b1663bf56d3326de2f4f08e5fd Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 3 Mar 2022 17:01:01 -0800 Subject: [PATCH] Mark `OwnedHandle` as `repr(transparent)`. This corresponds to rust-lang/rust#94572, which was recently approved. Also, fix a warning about a doc comment on an extern block. --- src/example_ffi.rs | 2 +- src/types.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/example_ffi.rs b/src/example_ffi.rs index ce0e197..e678ba8 100644 --- a/src/example_ffi.rs +++ b/src/example_ffi.rs @@ -21,7 +21,7 @@ use winapi::{ um::minwinbase::{LPOVERLAPPED, LPSECURITY_ATTRIBUTES}, }; -/// Declare a few FFI functions ourselves, to show off the FFI ergonomics. +// Declare a few FFI functions ourselves, to show off the FFI ergonomics. #[cfg(all(rustc_attrs, any(unix, target_os = "wasi")))] extern "C" { pub fn open(pathname: *const c_char, flags: c_int, ...) -> Option; diff --git a/src/types.rs b/src/types.rs index 4e49451..e61ae3f 100644 --- a/src/types.rs +++ b/src/types.rs @@ -206,6 +206,7 @@ impl OwnedFd { /// /// [here]: https://devblogs.microsoft.com/oldnewthing/20040302-00/?p=40443 #[cfg(windows)] +#[repr(transparent)] pub struct OwnedHandle { handle: RawHandle, }