about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-01-10 14:08:21 +0000
committerbors <bors@rust-lang.org>2017-01-10 14:08:21 +0000
commit7bffede97cf58f7159e261eac592f9cf88ce209d (patch)
treeffa2c2c7fbc25c4c6e6684d28f98331c78e2779d /src/libstd
parent78c892d8659ae1cf1717b9a8a4bb407d8667f672 (diff)
parentdb74f11f78e13fe2bbfb4e284c832d520fa5cf87 (diff)
downloadrust-7bffede97cf58f7159e261eac592f9cf88ce209d.tar.gz
rust-7bffede97cf58f7159e261eac592f9cf88ce209d.zip
Auto merge of #38958 - sanxiyn:rollup, r=sanxiyn
Rollup of 11 pull requests

- Successful merges: #38606, #38607, #38623, #38664, #38799, #38816, #38836, #38839, #38841, #38849, #38874
- Failed merges: #38845
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/collections/hash/table.rs3
-rw-r--r--src/libstd/ffi/os_str.rs23
-rw-r--r--src/libstd/lib.rs3
-rw-r--r--src/libstd/net/tcp.rs2
-rw-r--r--src/libstd/path.rs13
-rw-r--r--src/libstd/primitive_docs.rs2
-rw-r--r--src/libstd/sync/mutex.rs3
-rw-r--r--src/libstd/sync/rwlock.rs3
8 files changed, 39 insertions, 13 deletions
diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs
index 2cd9362a657..1ab62130cd3 100644
--- a/src/libstd/collections/hash/table.rs
+++ b/src/libstd/collections/hash/table.rs
@@ -1061,8 +1061,7 @@ impl<K: Clone, V: Clone> Clone for RawTable<K, V> {
     }
 }
 
-impl<K, V> Drop for RawTable<K, V> {
-    #[unsafe_destructor_blind_to_params]
+unsafe impl<#[may_dangle] K, #[may_dangle] V> Drop for RawTable<K, V> {
     fn drop(&mut self) {
         if self.capacity == 0 {
             return;
diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs
index 84b50f04463..175fe30db66 100644
--- a/src/libstd/ffi/os_str.rs
+++ b/src/libstd/ffi/os_str.rs
@@ -259,6 +259,15 @@ impl OsStr {
     /// Yields a `&str` slice if the `OsStr` is valid Unicode.
     ///
     /// This conversion may entail doing a check for UTF-8 validity.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::ffi::OsStr;
+    ///
+    /// let os_str = OsStr::new("foo");
+    /// assert_eq!(os_str.to_str(), Some("foo"));
+    /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn to_str(&self) -> Option<&str> {
         self.inner.to_str()
@@ -267,6 +276,20 @@ impl OsStr {
     /// Converts an `OsStr` to a `Cow<str>`.
     ///
     /// Any non-Unicode sequences are replaced with U+FFFD REPLACEMENT CHARACTER.
+    ///
+    /// # Examples
+    ///
+    /// Calling `to_string_lossy` on an `OsStr` with valid unicode:
+    ///
+    /// ```
+    /// use std::ffi::OsStr;
+    ///
+    /// let os_str = OsStr::new("foo");
+    /// assert_eq!(os_str.to_string_lossy(), "foo");
+    /// ```
+    ///
+    /// Had `os_str` contained invalid unicode, the `to_string_lossy` call might
+    /// have returned `"fo�"`.
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn to_string_lossy(&self) -> Cow<str> {
         self.inner.to_string_lossy()
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index 9557c520c50..521b938acfb 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -250,13 +250,14 @@
 #![feature(const_fn)]
 #![feature(core_float)]
 #![feature(core_intrinsics)]
-#![feature(dropck_parametricity)]
+#![feature(dropck_eyepatch)]
 #![feature(exact_size_is_empty)]
 #![feature(float_extras)]
 #![feature(float_from_str_radix)]
 #![feature(fn_traits)]
 #![feature(fnbox)]
 #![feature(fused)]
+#![feature(generic_param_attrs)]
 #![feature(hashmap_hasher)]
 #![feature(heap_api)]
 #![feature(inclusive_range)]
diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs
index ed1f08f9c90..e203789ce81 100644
--- a/src/libstd/net/tcp.rs
+++ b/src/libstd/net/tcp.rs
@@ -52,7 +52,7 @@ pub struct TcpStream(net_imp::TcpStream);
 ///     // ...
 /// }
 ///
-/// // accept connections and process them, spawning a new thread for each one
+/// // accept connections and process them serially
 /// for stream in listener.incoming() {
 ///     match stream {
 ///         Ok(stream) => {
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index d13baea40a9..3f9bf70adde 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -1428,8 +1428,8 @@ impl Path {
     /// ```
     /// use std::path::Path;
     ///
-    /// let path_str = Path::new("foo.txt").to_str();
-    /// assert_eq!(path_str, Some("foo.txt"));
+    /// let path = Path::new("foo.txt");
+    /// assert_eq!(path.to_str(), Some("foo.txt"));
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn to_str(&self) -> Option<&str> {
@@ -1444,12 +1444,17 @@ impl Path {
     ///
     /// # Examples
     ///
+    /// Calling `to_string_lossy` on a `Path` with valid unicode:
+    ///
     /// ```
     /// use std::path::Path;
     ///
-    /// let path_str = Path::new("foo.txt").to_string_lossy();
-    /// assert_eq!(path_str, "foo.txt");
+    /// let path = Path::new("foo.txt");
+    /// assert_eq!(path.to_string_lossy(), "foo.txt");
     /// ```
+    ///
+    /// Had `os_str` contained invalid unicode, the `to_string_lossy` call might
+    /// have returned `"fo�.txt"`.
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn to_string_lossy(&self) -> Cow<str> {
         self.inner.to_string_lossy()
diff --git a/src/libstd/primitive_docs.rs b/src/libstd/primitive_docs.rs
index 5981b482a97..ced0288766b 100644
--- a/src/libstd/primitive_docs.rs
+++ b/src/libstd/primitive_docs.rs
@@ -502,7 +502,7 @@ mod prim_str { }
 /// [`Hash`]: hash/trait.Hash.html
 ///
 /// Due to a temporary restriction in Rust's type system, these traits are only
-/// implemented on tuples of arity 32 or less. In the future, this may change.
+/// implemented on tuples of arity 12 or less. In the future, this may change.
 ///
 /// # Examples
 ///
diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs
index f6dbe01d7bd..f8426e3b578 100644
--- a/src/libstd/sync/mutex.rs
+++ b/src/libstd/sync/mutex.rs
@@ -280,8 +280,7 @@ impl<T: ?Sized> Mutex<T> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T: ?Sized> Drop for Mutex<T> {
-    #[unsafe_destructor_blind_to_params]
+unsafe impl<#[may_dangle] T: ?Sized> Drop for Mutex<T> {
     fn drop(&mut self) {
         // This is actually safe b/c we know that there is no further usage of
         // this mutex (it's up to the user to arrange for a mutex to get
diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs
index 0a11c71706b..adbb98e4b1f 100644
--- a/src/libstd/sync/rwlock.rs
+++ b/src/libstd/sync/rwlock.rs
@@ -310,8 +310,7 @@ impl<T: ?Sized> RwLock<T> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T: ?Sized> Drop for RwLock<T> {
-    #[unsafe_destructor_blind_to_params]
+unsafe impl<#[may_dangle] T: ?Sized> Drop for RwLock<T> {
     fn drop(&mut self) {
         // IMPORTANT: This code needs to be kept in sync with `RwLock::into_inner`.
         unsafe { self.inner.destroy() }