about summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-08-10 21:17:37 -0700
committerGitHub <noreply@github.com>2023-08-10 21:17:37 -0700
commit9546d7140ebfa77f3a569e7411709473a574e4b9 (patch)
treefa5fdcfa132168c7d63cf678aceb0830613b207e /library/alloc/src
parent5da7f36485d00e4ac7e58c98b60bd885ebb28a13 (diff)
parentf1fc871ce6b9e9f3549745043f28b54aa367d662 (diff)
downloadrust-9546d7140ebfa77f3a569e7411709473a574e4b9.tar.gz
rust-9546d7140ebfa77f3a569e7411709473a574e4b9.zip
Rollup merge of #114402 - tifv:tifv-fix-rc-doc, r=cuviper
Fix documentation of impl From<Vec<T>> for Rc<[T]>

The example in the documentation of `impl From<Vec<T>> for <Rc<[T]>` is irrelevant (likely was copied from `impl From<Box<T>> for <Rc<T>`). I suggest taking corresponding example from the documentation of `Arc` and replacing `Arc` with `Rc`.
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> {