about summary refs log tree commit diff
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2023-08-15 15:00:27 -0700
committerManish Goregaokar <manishsmail@gmail.com>2023-08-15 15:00:27 -0700
commit5bf1bfd784f3143e383f77d42b5c04752fd473e7 (patch)
tree2a206161969ba3ace2f0ba7f46f66889b57dae7f
parent10fc06fb819297373295ea48c1f37692ed33f8e7 (diff)
downloadrust-5bf1bfd784f3143e383f77d42b5c04752fd473e7.tar.gz
rust-5bf1bfd784f3143e383f77d42b5c04752fd473e7.zip
other elements
-rw-r--r--library/alloc/src/vec/mod.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs
index 9654e1d6997..6c238fd2d0c 100644
--- a/library/alloc/src/vec/mod.rs
+++ b/library/alloc/src/vec/mod.rs
@@ -1222,7 +1222,7 @@ impl<T, A: Allocator> Vec<T, A> {
     /// does not materialize a reference to the underlying slice, and thus the returned pointer
     /// will remain valid when mixed with other calls to [`as_ptr`] and [`as_mut_ptr`].
     /// Note that calling other methods that materialize mutable references to the slice,
-    /// or references to specific elements you are planning on accessing through this pointer,
+    /// or mutable references to specific elements you are planning on accessing through this pointer,
     /// may still invalidate this pointer.
     /// See the second example below for how this guarantee can be used.
     ///
@@ -1244,10 +1244,10 @@ impl<T, A: Allocator> Vec<T, A> {
     ///
     /// ```rust
     /// unsafe {
-    ///     let mut v = vec![0];
+    ///     let mut v = vec![0, 1, 2];
     ///     let ptr1 = v.as_ptr();
     ///     let _ = ptr1.read();
-    ///     let ptr2 = v.as_mut_ptr();
+    ///     let ptr2 = v.as_mut_ptr().offset(2);
     ///     ptr2.write(2);
     ///     // Notably, the write to `ptr2` did *not* invalidate `ptr1`:
     ///     let _ = ptr1.read();