about summary refs log tree commit diff
path: root/library/alloc/src/vec
diff options
context:
space:
mode:
authorMaybe Waffle <waffle.lapkin@gmail.com>2022-08-19 13:33:46 +0400
committerMaybe Waffle <waffle.lapkin@gmail.com>2022-08-21 02:22:20 +0400
commit3ba393465f262c68e7a2972ea18bc5547cf61340 (patch)
tree3d175d577b026d5ee26efc8455d5f0c9ed6d4abe /library/alloc/src/vec
parent6c943bad02626dddc5e5135b23c77429b6e4a063 (diff)
downloadrust-3ba393465f262c68e7a2972ea18bc5547cf61340.tar.gz
rust-3ba393465f262c68e7a2972ea18bc5547cf61340.zip
Make some docs nicer wrt pointer offsets
Diffstat (limited to 'library/alloc/src/vec')
-rw-r--r--library/alloc/src/vec/mod.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs
index fa9f2131c0c..fe4dcafe14c 100644
--- a/library/alloc/src/vec/mod.rs
+++ b/library/alloc/src/vec/mod.rs
@@ -542,8 +542,8 @@ impl<T> Vec<T> {
     ///
     /// unsafe {
     ///     // Overwrite memory with 4, 5, 6
-    ///     for i in 0..len as isize {
-    ///         ptr::write(p.offset(i), 4 + i);
+    ///     for i in 0..len {
+    ///         ptr::write(p.add(i), 4 + i);
     ///     }
     ///
     ///     // Put everything back together into a Vec
@@ -702,8 +702,8 @@ impl<T, A: Allocator> Vec<T, A> {
     ///
     /// unsafe {
     ///     // Overwrite memory with 4, 5, 6
-    ///     for i in 0..len as isize {
-    ///         ptr::write(p.offset(i), 4 + i);
+    ///     for i in 0..len {
+    ///         ptr::write(p.add(i), 4 + i);
     ///     }
     ///
     ///     // Put everything back together into a Vec