Skip to content

Commit 77879df

Browse files
committed
Rollup merge of rust-lang#21654 - FlaPer87:unify-impls, r=alexcrichton
Please, look at each commit to see the current differences and the desired result. Closes: rust-lang#20260 r? @alexcrichton
2 parents 619aefb + fde4472 commit 77879df

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

src/libstd/sys/windows/pipe.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ impl Drop for Event {
129129
}
130130
}
131131

132+
unsafe impl Send for Event {}
133+
unsafe impl Sync for Event {}
134+
132135
struct Inner {
133136
handle: libc::HANDLE,
134137
lock: Mutex<()>,
@@ -156,6 +159,9 @@ impl Drop for Inner {
156159
}
157160
}
158161

162+
unsafe impl Send for Inner {}
163+
unsafe impl Sync for Inner {}
164+
159165
unsafe fn pipe(name: *const u16, init: bool) -> libc::HANDLE {
160166
libc::CreateNamedPipeW(
161167
name,
@@ -220,9 +226,6 @@ pub struct UnixStream {
220226
write_deadline: u64,
221227
}
222228

223-
unsafe impl Send for UnixStream {}
224-
unsafe impl Sync for UnixStream {}
225-
226229
impl UnixStream {
227230
fn try_connect(p: *const u16) -> Option<libc::HANDLE> {
228231
// Note that most of this is lifted from the libuv implementation.
@@ -615,17 +618,11 @@ pub struct UnixAcceptor {
615618
deadline: u64,
616619
}
617620

618-
unsafe impl Send for UnixAcceptor {}
619-
unsafe impl Sync for UnixAcceptor {}
620-
621621
struct AcceptorState {
622622
abort: Event,
623623
closed: AtomicBool,
624624
}
625625

626-
unsafe impl Send for AcceptorState {}
627-
unsafe impl Sync for AcceptorState {}
628-
629626
impl UnixAcceptor {
630627
pub fn accept(&mut self) -> IoResult<UnixStream> {
631628
// This function has some funky implementation details when working with

src/libstd/sys/windows/tcp.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,13 @@ pub struct TcpAcceptor {
116116
deadline: u64,
117117
}
118118

119-
unsafe impl Send for TcpAcceptor {}
120-
unsafe impl Sync for TcpAcceptor {}
121-
122119
struct AcceptorInner {
123120
listener: TcpListener,
124121
abort: Event,
125122
accept: Event,
126123
closed: AtomicBool,
127124
}
128125

129-
unsafe impl Send for AcceptorInner {}
130126
unsafe impl Sync for AcceptorInner {}
131127

132128
impl TcpAcceptor {

0 commit comments

Comments
 (0)