diff options
author | Luca Casonato <hello@lcas.dev> | 2022-06-26 00:13:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-26 00:13:24 +0200 |
commit | 8d82ba729937baf83011354242cabc3d50c13dc2 (patch) | |
tree | 3e8c4d87986338639eeef4a76543e4335020262c /ext/net/ops_tls.rs | |
parent | 38505db39137f33bfdb942658ea892a617ac0980 (diff) |
build: require safety comments on unsafe code (#13870)
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
Diffstat (limited to 'ext/net/ops_tls.rs')
-rw-r--r-- | ext/net/ops_tls.rs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/ext/net/ops_tls.rs b/ext/net/ops_tls.rs index 8892ea0ac..1c91674df 100644 --- a/ext/net/ops_tls.rs +++ b/ext/net/ops_tls.rs @@ -375,11 +375,17 @@ impl TlsStreamInner { ready!(self.poll_io(cx, Flow::Read))?; if self.rd_state == State::StreamOpen { + // TODO(bartlomieju): + #[allow(clippy::undocumented_unsafe_blocks)] let buf_slice = unsafe { &mut *(buf.unfilled_mut() as *mut [_] as *mut [u8]) }; let bytes_read = self.tls.reader().read(buf_slice)?; assert_ne!(bytes_read, 0); - unsafe { buf.assume_init(bytes_read) }; + // TODO(bartlomieju): + #[allow(clippy::undocumented_unsafe_blocks)] + unsafe { + buf.assume_init(bytes_read) + }; buf.advance(bytes_read); } @@ -581,10 +587,16 @@ impl Shared { let self_weak = Arc::downgrade(self); let self_ptr = self_weak.into_raw() as *const (); let raw_waker = RawWaker::new(self_ptr, &Self::SHARED_WAKER_VTABLE); - unsafe { Waker::from_raw(raw_waker) } + // TODO(bartlomieju): + #[allow(clippy::undocumented_unsafe_blocks)] + unsafe { + Waker::from_raw(raw_waker) + } } fn clone_shared_waker(self_ptr: *const ()) -> RawWaker { + // TODO(bartlomieju): + #[allow(clippy::undocumented_unsafe_blocks)] let self_weak = unsafe { Weak::from_raw(self_ptr as *const Self) }; let ptr1 = self_weak.clone().into_raw(); let ptr2 = self_weak.into_raw(); @@ -598,6 +610,8 @@ impl Shared { } fn wake_shared_waker_by_ref(self_ptr: *const ()) { + // TODO(bartlomieju): + #[allow(clippy::undocumented_unsafe_blocks)] let self_weak = unsafe { Weak::from_raw(self_ptr as *const Self) }; if let Some(self_arc) = Weak::upgrade(&self_weak) { self_arc.rd_waker.wake(); @@ -607,6 +621,8 @@ impl Shared { } fn drop_shared_waker(self_ptr: *const ()) { + // TODO(bartlomieju): + #[allow(clippy::undocumented_unsafe_blocks)] let _ = unsafe { Weak::from_raw(self_ptr as *const Self) }; } |