diff options
| author | Michael Goulet <michael@errs.io> | 2023-08-10 21:17:37 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-10 21:17:37 -0700 |
| commit | 9546d7140ebfa77f3a569e7411709473a574e4b9 (patch) | |
| tree | fa5fdcfa132168c7d63cf678aceb0830613b207e /library/alloc/src | |
| parent | 5da7f36485d00e4ac7e58c98b60bd885ebb28a13 (diff) | |
| parent | f1fc871ce6b9e9f3549745043f28b54aa367d662 (diff) | |
| download | rust-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.rs | 6 |
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> { |
