diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-07-27 17:40:49 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-07-27 17:40:49 +0200 |
| commit | 4ad743c022c725a62bafa7a2795fcc2055afb124 (patch) | |
| tree | 44bdb564a0e800395dd53994e875f6ea0d20d53d /src/libstd/sys | |
| parent | b25d74fa49049a18528605034e414b31860dc0f6 (diff) | |
| parent | d7b211025ef4fface0f3cd3a01ec19d0b08d7cf6 (diff) | |
| download | rust-4ad743c022c725a62bafa7a2795fcc2055afb124.tar.gz rust-4ad743c022c725a62bafa7a2795fcc2055afb124.zip | |
Rollup merge of #63013 - nivkner:ffi-safe-slice, r=sfackler
add `repr(transparent)` to `IoSliceMut` where missing tried using `IoSliceMut` in FFI, got `improper_ctypes` warning. according to the docs: `IoSliceMut` is "guaranteed to be ABI compatible with the `iovec` type" so it should be usable in FFI. `IoSlice` is also `repr(transparent)` for every platform where these types contain `iovec`-like types. vxworks also has `IoSliceMut` as transparent so its not even consistently one or the other. no comment about this next to the types or in the PR that introduced the types, so assuming this was just missed. r? @sfackler
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/unix/io.rs | 1 | ||||
| -rw-r--r-- | src/libstd/sys/wasi/io.rs | 1 | ||||
| -rw-r--r-- | src/libstd/sys/windows/io.rs | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/src/libstd/sys/unix/io.rs b/src/libstd/sys/unix/io.rs index 72954ff20ef..bc854e772e1 100644 --- a/src/libstd/sys/unix/io.rs +++ b/src/libstd/sys/unix/io.rs @@ -29,6 +29,7 @@ impl<'a> IoSlice<'a> { } } +#[repr(transparent)] pub struct IoSliceMut<'a> { vec: iovec, _p: PhantomData<&'a mut [u8]>, diff --git a/src/libstd/sys/wasi/io.rs b/src/libstd/sys/wasi/io.rs index cc8f1e16fa0..a5bddad708b 100644 --- a/src/libstd/sys/wasi/io.rs +++ b/src/libstd/sys/wasi/io.rs @@ -29,6 +29,7 @@ impl<'a> IoSlice<'a> { } } +#[repr(transparent)] pub struct IoSliceMut<'a> { vec: __wasi_iovec_t, _p: PhantomData<&'a mut [u8]>, diff --git a/src/libstd/sys/windows/io.rs b/src/libstd/sys/windows/io.rs index c045a63e911..f0da2323f4f 100644 --- a/src/libstd/sys/windows/io.rs +++ b/src/libstd/sys/windows/io.rs @@ -29,6 +29,7 @@ impl<'a> IoSlice<'a> { } } +#[repr(transparent)] pub struct IoSliceMut<'a> { vec: c::WSABUF, _p: PhantomData<&'a mut [u8]>, |
