Skip to content

Commit 9546d71

Browse files
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`.
2 parents 5da7f36 + f1fc871 commit 9546d71

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

library/alloc/src/rc.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2491,9 +2491,9 @@ impl<T, A: Allocator> From<Vec<T, A>> for Rc<[T], A> {
24912491
///
24922492
/// ```
24932493
/// # use std::rc::Rc;
2494-
/// let original: Box<Vec<i32>> = Box::new(vec![1, 2, 3]);
2495-
/// let shared: Rc<Vec<i32>> = Rc::from(original);
2496-
/// assert_eq!(vec![1, 2, 3], *shared);
2494+
/// let unique: Vec<i32> = vec![1, 2, 3];
2495+
/// let shared: Rc<[i32]> = Rc::from(unique);
2496+
/// assert_eq!(&[1, 2, 3], &shared[..]);
24972497
/// ```
24982498
#[inline]
24992499
fn from(v: Vec<T, A>) -> Rc<[T], A> {

0 commit comments

Comments
 (0)