about summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorJuly Tikhonov <july.tikh@gmail.com>2023-08-03 10:44:23 +0300
committerGitHub <noreply@github.com>2023-08-03 10:44:23 +0300
commitf1fc871ce6b9e9f3549745043f28b54aa367d662 (patch)
treec2465aa3c6d5e162a4f73833dac930f0f48e65bd /library/alloc/src
parentfb31b3c34ef4a67bcd5b1dad919dfaa4cab2c569 (diff)
downloadrust-f1fc871ce6b9e9f3549745043f28b54aa367d662.tar.gz
rust-f1fc871ce6b9e9f3549745043f28b54aa367d662.zip
Fix documentation of Rc as From<Vec<T>>
Diffstat (limited to 'library/alloc/src')
-rw-r--r--library/alloc/src/rc.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs
index 60b07485c3a..afed3fdf745 100644
--- a/library/alloc/src/rc.rs
+++ b/library/alloc/src/rc.rs
@@ -2491,9 +2491,9 @@ impl<T, A: Allocator> From<Vec<T, A>> for Rc<[T], A> {
     ///
     /// ```
     /// # use std::rc::Rc;
-    /// let original: Box<Vec<i32>> = Box::new(vec![1, 2, 3]);
-    /// let shared: Rc<Vec<i32>> = Rc::from(original);
-    /// assert_eq!(vec![1, 2, 3], *shared);
+    /// let unique: Vec<i32> = vec![1, 2, 3];
+    /// let shared: Rc<[i32]> = Rc::from(unique);
+    /// assert_eq!(&[1, 2, 3], &shared[..]);
     /// ```
     #[inline]
     fn from(v: Vec<T, A>) -> Rc<[T], A> {