Skip to content

Commit f1fc871

Browse files
authoredAug 3, 2023
Fix documentation of Rc as From<Vec<T>>
1 parent fb31b3c commit f1fc871

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)
Please sign in to comment.