Skip to content

Commit 3b3a8df

Browse files
authored
Unrolled build for #143191
Rollup merge of #143191 - connortsui20:stabilize-rwlock-downgrade, r=tgross35 Stabilize `rwlock_downgrade` library feature Tracking Issue: #128203 Method to be stabilized: ```rust impl<'a, T: ?Sized> RwLockWriteGuard<'a, T> { pub fn downgrade(s: Self) -> RwLockReadGuard<'a, T> {} } ``` ~~I would like to point out that my documentation comment is longer than ideal, but at the same time I don't really know how else to show why `downgrade` is actually necessary (instead of just unlocking and relocking). If anyone has ideas for making this more concise that would be great!~~ I have made the documentation a bit more clear. Stabilization report: #128203 (comment)
2 parents 57ef8d6 + 780319a commit 3b3a8df

File tree

3 files changed

+2
-10
lines changed

3 files changed

+2
-10
lines changed

library/std/src/sync/nonpoison/rwlock.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,6 @@ impl<'rwlock, T: ?Sized> RwLockWriteGuard<'rwlock, T> {
700700
///
701701
/// ```
702702
/// #![feature(nonpoison_rwlock)]
703-
/// #![feature(rwlock_downgrade)]
704703
///
705704
/// use std::sync::nonpoison::{RwLock, RwLockWriteGuard};
706705
///
@@ -719,7 +718,6 @@ impl<'rwlock, T: ?Sized> RwLockWriteGuard<'rwlock, T> {
719718
///
720719
/// ```
721720
/// #![feature(nonpoison_rwlock)]
722-
/// #![feature(rwlock_downgrade)]
723721
///
724722
/// use std::sync::Arc;
725723
/// use std::sync::nonpoison::{RwLock, RwLockWriteGuard};
@@ -752,8 +750,7 @@ impl<'rwlock, T: ?Sized> RwLockWriteGuard<'rwlock, T> {
752750
/// # let final_check = rw.read();
753751
/// # assert_eq!(*final_check, 3);
754752
/// ```
755-
#[unstable(feature = "rwlock_downgrade", issue = "128203")]
756-
// #[unstable(feature = "nonpoison_rwlock", issue = "134645")]
753+
#[unstable(feature = "nonpoison_rwlock", issue = "134645")]
757754
pub fn downgrade(s: Self) -> RwLockReadGuard<'rwlock, T> {
758755
let lock = s.lock;
759756

library/std/src/sync/poison/rwlock.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -813,8 +813,6 @@ impl<'rwlock, T: ?Sized> RwLockWriteGuard<'rwlock, T> {
813813
/// `downgrade` takes ownership of the `RwLockWriteGuard` and returns a [`RwLockReadGuard`].
814814
///
815815
/// ```
816-
/// #![feature(rwlock_downgrade)]
817-
///
818816
/// use std::sync::{RwLock, RwLockWriteGuard};
819817
///
820818
/// let rw = RwLock::new(0);
@@ -831,8 +829,6 @@ impl<'rwlock, T: ?Sized> RwLockWriteGuard<'rwlock, T> {
831829
/// thread calling `downgrade` and any reads it performs after downgrading.
832830
///
833831
/// ```
834-
/// #![feature(rwlock_downgrade)]
835-
///
836832
/// use std::sync::{Arc, RwLock, RwLockWriteGuard};
837833
///
838834
/// let rw = Arc::new(RwLock::new(1));
@@ -863,7 +859,7 @@ impl<'rwlock, T: ?Sized> RwLockWriteGuard<'rwlock, T> {
863859
/// # let final_check = rw.read().unwrap();
864860
/// # assert_eq!(*final_check, 3);
865861
/// ```
866-
#[unstable(feature = "rwlock_downgrade", issue = "128203")]
862+
#[stable(feature = "rwlock_downgrade", since = "CURRENT_RUSTC_VERSION")]
867863
pub fn downgrade(s: Self) -> RwLockReadGuard<'rwlock, T> {
868864
let lock = s.lock;
869865

library/std/tests/sync/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#![feature(once_cell_try)]
55
#![feature(lock_value_accessors)]
66
#![feature(reentrant_lock)]
7-
#![feature(rwlock_downgrade)]
87
#![feature(std_internals)]
98
#![feature(sync_nonpoison)]
109
#![feature(nonpoison_condvar)]

0 commit comments

Comments
 (0)