From 8dc1e42515adbf0946a235b464b2fd41619cec04 Mon Sep 17 00:00:00 2001 From: Yashhwanth Ram Date: Thu, 2 Jul 2020 11:33:37 +0530 Subject: libstd/net/tcp.rs: #![deny(unsafe_op_in_unsafe_fn)] Enclose unsafe operations in unsafe blocks --- src/libstd/net/tcp.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/libstd') 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")] -- cgit 1.4.1-3-g733a5 From af2962027721b8dc700de339350f96b284c15fcd Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 28 Jun 2020 00:43:01 +0200 Subject: Fix links --- src/librustdoc/passes/collect_intra_doc_links.rs | 2 +- src/libstd/sys/unix/ext/fs.rs | 2 +- src/libstd/sys/vxworks/ext/fs.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/libstd') diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 8da74f375d9..0e6a6c8a5e6 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -1069,7 +1069,7 @@ fn handle_variant( }; let parent_def = Res::Def(DefKind::Enum, parent); let variant = cx.tcx.expect_variant_res(res); - Ok((parent_def, Some(format!("{}.v", variant.ident.name)))) + Ok((parent_def, Some(format!("variant.{}", variant.ident.name)))) } const PRIMITIVES: &[(&str, Res)] = &[ diff --git a/src/libstd/sys/unix/ext/fs.rs b/src/libstd/sys/unix/ext/fs.rs index e4d71493604..2b2bbc6e9d6 100644 --- a/src/libstd/sys/unix/ext/fs.rs +++ b/src/libstd/sys/unix/ext/fs.rs @@ -133,7 +133,7 @@ pub trait FileExt { /// Note that similar to [`File::write`], it is not an error to return a /// short write. /// - /// [`File::write`]: ../../../../std/fs/struct.File.html#write.v + /// [`File::write`]: ../../../../std/fs/struct.File.html#method.write /// /// # Examples /// diff --git a/src/libstd/sys/vxworks/ext/fs.rs b/src/libstd/sys/vxworks/ext/fs.rs index 7cc64658ee1..b479fbaf346 100644 --- a/src/libstd/sys/vxworks/ext/fs.rs +++ b/src/libstd/sys/vxworks/ext/fs.rs @@ -132,7 +132,7 @@ pub trait FileExt { /// Note that similar to [`File::write`], it is not an error to return a /// short write. /// - /// [`File::write`]: ../../../../std/fs/struct.File.html#write.v + /// [`File::write`]: ../../../../std/fs/struct.File.html#method.write /// /// # Examples /// -- cgit 1.4.1-3-g733a5 From 6196eaa0b1ca4e7857d8d62817aebf3b03216a57 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 3 Jul 2020 12:05:59 -0700 Subject: Fix the return type of Windows' `OpenOptionsExt::security_qos_flags`. This adjusts the return type of Windows' `OpenOptionsExt::security_qos_flags` to be consistent with the other functions in the trait. --- src/libstd/sys/windows/ext/fs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libstd') diff --git a/src/libstd/sys/windows/ext/fs.rs b/src/libstd/sys/windows/ext/fs.rs index f85120d170f..81b2bf99872 100644 --- a/src/libstd/sys/windows/ext/fs.rs +++ b/src/libstd/sys/windows/ext/fs.rs @@ -259,7 +259,7 @@ pub trait OpenOptionsExt { /// [Impersonation Levels]: /// https://docs.microsoft.com/en-us/windows/win32/api/winnt/ne-winnt-security_impersonation_level #[stable(feature = "open_options_ext", since = "1.10.0")] - fn security_qos_flags(&mut self, flags: u32) -> &mut OpenOptions; + fn security_qos_flags(&mut self, flags: u32) -> &mut Self; } #[stable(feature = "open_options_ext", since = "1.10.0")] -- cgit 1.4.1-3-g733a5