Skip to content

Commit

Permalink
Rollup merge of rust-lang#89833 - jkugelman:must-use-rc-downgrade, r=…
Browse files Browse the repository at this point in the history
…joshtriplett

Add #[must_use] to Rc::downgrade

Missed this in previous PR rust-lang#89796 (comment)

Parent issue: rust-lang#89692

r? ``@joshtriplett``
  • Loading branch information
matthiaskrgr authored Oct 31, 2021
2 parents ba05480 + 5bb99bb commit b30d41d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion library/alloc/src/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>`'s implementations of traits like `Clone` may also be called using
Expand Down Expand Up @@ -889,6 +889,8 @@ impl<T: ?Sized> Rc<T> {
///
/// 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<T> {
this.inner().inc_weak();
Expand Down

0 comments on commit b30d41d

Please sign in to comment.