Skip to content
/ rust Public
forked from rust-lang/rust

Commit bf2ff12

Browse files
authored
Rollup merge of rust-lang#136228 - hkBst:patch-28, r=Mark-Simulacrum
Simplify Rc::as_ptr docs + typo fix
2 parents 19a8a58 + 717d36a commit bf2ff12

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: library/alloc/src/rc.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1462,18 +1462,18 @@ impl<T: ?Sized, A: Allocator> Rc<T, A> {
14621462
/// Provides a raw pointer to the data.
14631463
///
14641464
/// The counts are not affected in any way and the `Rc` is not consumed. The pointer is valid
1465-
/// for as long there are strong counts in the `Rc`.
1465+
/// for as long as there are strong counts in the `Rc`.
14661466
///
14671467
/// # Examples
14681468
///
14691469
/// ```
14701470
/// use std::rc::Rc;
14711471
///
1472-
/// let x = Rc::new("hello".to_owned());
1472+
/// let x = Rc::new(0);
14731473
/// let y = Rc::clone(&x);
14741474
/// let x_ptr = Rc::as_ptr(&x);
14751475
/// assert_eq!(x_ptr, Rc::as_ptr(&y));
1476-
/// assert_eq!(unsafe { &*x_ptr }, "hello");
1476+
/// assert_eq!(unsafe { *x_ptr }, 0);
14771477
/// ```
14781478
#[stable(feature = "weak_into_raw", since = "1.45.0")]
14791479
#[rustc_never_returns_null_ptr]

0 commit comments

Comments
 (0)