about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-05-28 11:50:14 +0000
committerbors <bors@rust-lang.org>2019-05-28 11:50:14 +0000
commit7da118581c9dc839c8bf3fbb622bab9ce32bbf38 (patch)
tree6afa790e230d5ecc9d3ee1849652e00c74688137 /src/libcore
parent837b72c805f98d95a44ad4fc2b43ba6a8acb108a (diff)
parent149c53fc442a690ea6a5c309f408cb2160039b9b (diff)
downloadrust-7da118581c9dc839c8bf3fbb622bab9ce32bbf38.tar.gz
rust-7da118581c9dc839c8bf3fbb622bab9ce32bbf38.zip
Auto merge of #61258 - Centril:rollup-l2mof9t, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #61084 (Clarify docs for unreachable! macro)
 - #61220 (Added error message for E0284)
 - #61227 (Use .await syntax instead of await!)
 - #61230 (avoid creating Boxes of uninitalized values in RawVec)
 - #61237 (Updated the Iterator docs with information about overriding methods.)
 - #61241 (Check place iterative)
 - #61242 (Make dest_needs_borrow iterate instead of recurse)
 - #61247 (Make eval_place iterate instead of recurse)
 - #61248 (Use Place::local)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/future/future.rs2
-rw-r--r--src/libcore/iter/mod.rs5
-rw-r--r--src/libcore/iter/traits/iterator.rs1
-rw-r--r--src/libcore/macros.rs7
4 files changed, 11 insertions, 4 deletions
diff --git a/src/libcore/future/future.rs b/src/libcore/future/future.rs
index 3f76ac20192..0492fd709b8 100644
--- a/src/libcore/future/future.rs
+++ b/src/libcore/future/future.rs
@@ -21,7 +21,7 @@ use crate::task::{Context, Poll};
 /// task.
 ///
 /// When using a future, you generally won't call `poll` directly, but instead
-/// `await!` the value.
+/// `.await` the value.
 #[doc(spotlight)]
 #[must_use = "futures do nothing unless you `.await` or poll them"]
 #[stable(feature = "futures_api", since = "1.36.0")]
diff --git a/src/libcore/iter/mod.rs b/src/libcore/iter/mod.rs
index 1601357d3b0..6eccb9d1ea8 100644
--- a/src/libcore/iter/mod.rs
+++ b/src/libcore/iter/mod.rs
@@ -140,6 +140,11 @@
 //! call `next()` on your iterator, until it reaches `None`. Let's go over that
 //! next.
 //!
+//! Also note that `Iterator` provides a default implementation of methods such as `nth` and `fold`
+//! which call `next` internally. However, it is also possible to write a custom implementation of
+//! methods like `nth` and `fold` if an iterator can compute them more efficiently without calling
+//! `next`.
+//!
 //! # for Loops and IntoIterator
 //!
 //! Rust's `for` loop syntax is actually sugar for iterators. Here's a basic
diff --git a/src/libcore/iter/traits/iterator.rs b/src/libcore/iter/traits/iterator.rs
index 38c7c9bc4d0..d0fdd79473e 100644
--- a/src/libcore/iter/traits/iterator.rs
+++ b/src/libcore/iter/traits/iterator.rs
@@ -964,6 +964,7 @@ pub trait Iterator {
     /// Creates an iterator that skips the first `n` elements.
     ///
     /// After they have been consumed, the rest of the elements are yielded.
+    /// Rather than overriding this method directly, instead override the `nth` method.
     ///
     /// # Examples
     ///
diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs
index d2ee9b11b36..9dfa09cf8a5 100644
--- a/src/libcore/macros.rs
+++ b/src/libcore/macros.rs
@@ -445,9 +445,10 @@ macro_rules! writeln {
 /// * Iterators that dynamically terminate.
 ///
 /// If the determination that the code is unreachable proves incorrect, the
-/// program immediately terminates with a [`panic!`]. The function [`unreachable_unchecked`],
-/// which belongs to the [`std::hint`] module, informs the compiler to
-/// optimize the code out of the release version entirely.
+/// program immediately terminates with a [`panic!`].
+///
+/// The unsafe counterpart of this macro is the [`unreachable_unchecked`] function, which
+/// will cause undefined behavior if the code is reached.
 ///
 /// [`panic!`]:  ../std/macro.panic.html
 /// [`unreachable_unchecked`]: ../std/hint/fn.unreachable_unchecked.html