about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2020-09-16 08:24:56 +0200
committerGitHub <noreply@github.com>2020-09-16 08:24:56 +0200
commit17015cd5afd48ebda9f4f77e2d57e18e7aede1ab (patch)
tree68525a98003318cf92d58f91a5e457a92b2343f9
parent3a4de42a8d97043f99f9710a92d51208d41193a8 (diff)
parent8b0d0a0cadbaaf0e7f4114e289a71981872c8587 (diff)
downloadrust-17015cd5afd48ebda9f4f77e2d57e18e7aede1ab.tar.gz
rust-17015cd5afd48ebda9f4f77e2d57e18e7aede1ab.zip
Rollup merge of #76534 - notriddle:doc-comments, r=jyn514
Add doc comments for From impls

https://github.com/rust-lang/rust/issues/51430
-rw-r--r--library/alloc/src/collections/binary_heap.rs4
-rw-r--r--library/core/src/task/poll.rs8
2 files changed, 12 insertions, 0 deletions
diff --git a/library/alloc/src/collections/binary_heap.rs b/library/alloc/src/collections/binary_heap.rs
index 40aa4d850f5..24d17fdd880 100644
--- a/library/alloc/src/collections/binary_heap.rs
+++ b/library/alloc/src/collections/binary_heap.rs
@@ -1343,6 +1343,10 @@ impl<T: Ord> From<Vec<T>> for BinaryHeap<T> {
 
 #[stable(feature = "binary_heap_extras_15", since = "1.5.0")]
 impl<T> From<BinaryHeap<T>> for Vec<T> {
+    /// Converts a `BinaryHeap<T>` into a `Vec<T>`.
+    ///
+    /// This conversion requires no data movement or allocation, and has
+    /// constant time complexity.
     fn from(heap: BinaryHeap<T>) -> Vec<T> {
         heap.data
     }
diff --git a/library/core/src/task/poll.rs b/library/core/src/task/poll.rs
index 9383e7c45fa..4e987a53b2c 100644
--- a/library/core/src/task/poll.rs
+++ b/library/core/src/task/poll.rs
@@ -112,6 +112,14 @@ impl<T, E> Poll<Option<Result<T, E>>> {
 
 #[stable(feature = "futures_api", since = "1.36.0")]
 impl<T> From<T> for Poll<T> {
+    /// Convert to a `Ready` variant.
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use core::task::Poll;
+    /// assert_eq!(Poll::from(true), Poll::Ready(true));
+    /// ```
     fn from(t: T) -> Poll<T> {
         Poll::Ready(t)
     }