We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ba05480 + 5bb99bb commit b30d41dCopy full SHA for b30d41d
library/alloc/src/rc.rs
@@ -41,7 +41,7 @@
41
//! use std::rc::Rc;
42
//!
43
//! let my_rc = Rc::new(());
44
-//! Rc::downgrade(&my_rc);
+//! let my_weak = Rc::downgrade(&my_rc);
45
//! ```
46
47
//! `Rc<T>`'s implementations of traits like `Clone` may also be called using
@@ -889,6 +889,8 @@ impl<T: ?Sized> Rc<T> {
889
///
890
/// let weak_five = Rc::downgrade(&five);
891
/// ```
892
+ #[must_use = "this returns a new `Weak` pointer, \
893
+ without modifying the original `Rc`"]
894
#[stable(feature = "rc_weak", since = "1.4.0")]
895
pub fn downgrade(this: &Self) -> Weak<T> {
896
this.inner().inc_weak();
0 commit comments