about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPietro Albini <pietro@pietroalbini.org>2020-02-24 11:15:33 +0100
committerGitHub <noreply@github.com>2020-02-24 11:15:33 +0100
commitc293ac9503bd7c5055b0d37ccee4d061fc28f61c (patch)
tree2956885150b86b146d6f9332720eb3cfc747a6a4
parentd73aa67208447dcc38c01bb01b513eccf3dfc3d2 (diff)
parent2cf339aeda77f29a8ad609f88b67591e0a668b89 (diff)
downloadrust-c293ac9503bd7c5055b0d37ccee4d061fc28f61c.tar.gz
rust-c293ac9503bd7c5055b0d37ccee4d061fc28f61c.zip
Rollup merge of #69386 - danielhenrymantilla:maybe_uninit_docs_replace_chunk_with_windows, r=Dylan-DPC
Fix minor error in `MaybeUninit::get_mut()` doc example

In the `MaybeUninit::get_mut()` example I wanted to assert that the slice was sorted and mistakenly used `.chunks(2)` rather than `.windows(2)` to assert it, as @ametisf pointed out in https://github.com/rust-lang/rust/pull/65948#issuecomment-589988183 .

This fixes it.
-rw-r--r--src/libcore/mem/maybe_uninit.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libcore/mem/maybe_uninit.rs b/src/libcore/mem/maybe_uninit.rs
index 5fb3c651b6b..58aaac21ad7 100644
--- a/src/libcore/mem/maybe_uninit.rs
+++ b/src/libcore/mem/maybe_uninit.rs
@@ -669,7 +669,7 @@ impl<T> MaybeUninit<T> {
     /// // Now we can use `buf` as a normal slice:
     /// buf.sort_unstable();
     /// assert!(
-    ///     buf.chunks(2).all(|chunk| chunk[0] <= chunk[1]),
+    ///     buf.windows(2).all(|pair| pair[0] <= pair[1]),
     ///     "buffer is sorted",
     /// );
     /// ```