about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-11-05 09:31:36 +0000
committerbors <bors@rust-lang.org>2019-11-05 09:31:36 +0000
commitd1fff4a4b213b3341c1ff994061b7965a5932c70 (patch)
tree092a1579b1c3ddeccf48280bbf1d0a0294eaa716 /src/liballoc
parent2e4da3caadc61fab2cfcffebcbfdd72fbcee62b7 (diff)
parent1ffa93e5f8229c34286f50d1d79dd410324a7d9d (diff)
Auto merge of #66109 - pietroalbini:rollup-2npidna, r=pietroalbini
Rollup of 10 pull requests

Successful merges:

 - #65136 (Update codegen option documentation.)
 - #65574 (docs: improve disclaimer regarding LinkedList)
 - #65720 (Add FFI bindings for LLVM's Module::getInstructionCount())
 - #65905 ([doc] fixes for unix/vxworks `OpenOptionsExt::mode`)
 - #65962 (Fix logic in example.)
 - #66019 (Improved std::iter::Chain documentation)
 - #66038 (doc(str): show example of chars().count() under len())
 - #66042 (Suggest correct code when encountering an incorrect trait bound referencing the current trait)
 - #66073 (Do not needlessly write-lock)
 - #66096 (Add a failing UI test for multiple loops of all kinds in a `const`)

Failed merges:

r? @ghost
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/collections/linked_list.rs14
-rw-r--r--src/liballoc/string.rs9
2 files changed, 14 insertions, 9 deletions
diff --git a/src/liballoc/collections/linked_list.rs b/src/liballoc/collections/linked_list.rs
index 702df250999..48f9865b870 100644
--- a/src/liballoc/collections/linked_list.rs
+++ b/src/liballoc/collections/linked_list.rs
@@ -3,11 +3,11 @@
 //! The `LinkedList` allows pushing and popping elements at either end
 //! in constant time.
 //!
-//! Almost always it is better to use `Vec` or [`VecDeque`] instead of
-//! [`LinkedList`]. In general, array-based containers are faster,
-//! more memory efficient and make better use of CPU cache.
+//! NOTE: It is almost always better to use [`Vec`] or [`VecDeque`] because
+//! array-based containers are generally faster,
+//! more memory efficient, and make better use of CPU cache.
 //!
-//! [`LinkedList`]: ../linked_list/struct.LinkedList.html
+//! [`Vec`]: ../../vec/struct.Vec.html
 //! [`VecDeque`]: ../vec_deque/struct.VecDeque.html
 
 #![stable(feature = "rust1", since = "1.0.0")]
@@ -31,9 +31,9 @@ mod tests;
 /// The `LinkedList` allows pushing and popping elements at either end
 /// in constant time.
 ///
-/// Almost always it is better to use `Vec` or `VecDeque` instead of
-/// `LinkedList`. In general, array-based containers are faster,
-/// more memory efficient and make better use of CPU cache.
+/// NOTE: It is almost always better to use `Vec` or `VecDeque` because
+/// array-based containers are generally faster,
+/// more memory efficient, and make better use of CPU cache.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct LinkedList<T> {
     head: Option<NonNull<Node<T>>>,
diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs
index d9927c642b2..0e5746d0d9d 100644
--- a/src/liballoc/string.rs
+++ b/src/liballoc/string.rs
@@ -1402,7 +1402,9 @@ impl String {
         &mut self.vec
     }
 
-    /// Returns the length of this `String`, in bytes.
+    /// Returns the length of this `String`, in bytes, not [`char`]s or
+    /// graphemes. In other words, it may not be what a human considers the
+    /// length of the string.
     ///
     /// # Examples
     ///
@@ -1410,8 +1412,11 @@ impl String {
     ///
     /// ```
     /// let a = String::from("foo");
-    ///
     /// assert_eq!(a.len(), 3);
+    ///
+    /// let fancy_f = String::from("ƒoo");
+    /// assert_eq!(fancy_f.len(), 4);
+    /// assert_eq!(fancy_f.chars().count(), 3);
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]