diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs index 493cf3117edf6..e9cded6736474 100644 --- a/library/alloc/src/rc.rs +++ b/library/alloc/src/rc.rs @@ -41,7 +41,7 @@ //! use std::rc::Rc; //! //! let my_rc = Rc::new(()); -//! Rc::downgrade(&my_rc); +//! let my_weak = Rc::downgrade(&my_rc); //! ``` //! //! `Rc`'s implementations of traits like `Clone` may also be called using @@ -889,6 +889,8 @@ impl Rc { /// /// let weak_five = Rc::downgrade(&five); /// ``` + #[must_use = "this returns a new `Weak` pointer, \ + without modifying the original `Rc`"] #[stable(feature = "rc_weak", since = "1.4.0")] pub fn downgrade(this: &Self) -> Weak { this.inner().inc_weak();