diff options
| author | Yashhwanth Ram <ryr397@gmail.com> | 2020-07-02 11:33:37 +0530 |
|---|---|---|
| committer | Yashhwanth Ram <ryr397@gmail.com> | 2020-07-02 11:33:37 +0530 |
| commit | 8dc1e42515adbf0946a235b464b2fd41619cec04 (patch) | |
| tree | 06c4ad8baa3ad098256a1c76ed639af30a3c8346 | |
| parent | 9491f18c5de3ff1c4bf9c3fdacf52d9859e26f7c (diff) | |
| download | rust-8dc1e42515adbf0946a235b464b2fd41619cec04.tar.gz rust-8dc1e42515adbf0946a235b464b2fd41619cec04.zip | |
libstd/net/tcp.rs: #![deny(unsafe_op_in_unsafe_fn)]
Enclose unsafe operations in unsafe blocks
| -rw-r--r-- | src/libstd/net/tcp.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs index 9ac54dd5f7a..47b8532b7a6 100644 --- a/src/libstd/net/tcp.rs +++ b/src/libstd/net/tcp.rs @@ -1,3 +1,4 @@ +#![deny(unsafe_op_in_unsafe_fn)] use crate::io::prelude::*; use crate::fmt; @@ -583,7 +584,8 @@ impl Read for TcpStream { #[inline] unsafe fn initializer(&self) -> Initializer { - Initializer::nop() + // SAFETY: Read is guaranteed to work on uninitialized memory + unsafe { Initializer::nop() } } } #[stable(feature = "rust1", since = "1.0.0")] @@ -622,7 +624,8 @@ impl Read for &TcpStream { #[inline] unsafe fn initializer(&self) -> Initializer { - Initializer::nop() + // SAFETY: Read is guaranteed to work on uninitialized memory + unsafe { Initializer::nop() } } } #[stable(feature = "rust1", since = "1.0.0")] |
