diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-10-31 09:20:23 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-31 09:20:23 +0100 |
| commit | 3cf3910c15a3c33dde3c380ac57501d37aa58e71 (patch) | |
| tree | 3842d284ec3368375fae2bb5e243f66028823f38 | |
| parent | 15a0cddff3a4fa0c66a7689ef3ba615a6d2366e5 (diff) | |
| parent | 5bb99bb02d6d0ec4d9239fd9bce48a41fb084811 (diff) | |
| download | rust-3cf3910c15a3c33dde3c380ac57501d37aa58e71.tar.gz rust-3cf3910c15a3c33dde3c380ac57501d37aa58e71.zip | |
Rollup merge of #89833 - jkugelman:must-use-rc-downgrade, r=joshtriplett
Add #[must_use] to Rc::downgrade Missed this in previous PR https://github.com/rust-lang/rust/pull/89796#issuecomment-941456006 Parent issue: #89692 r? ```@joshtriplett```
| -rw-r--r-- | library/alloc/src/rc.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs index 2950ec421da..c0ca068de9c 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<T>`'s implementations of traits like `Clone` may also be called using @@ -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(); |
