Skip to content

Commit 513eda0

Browse files
committed
make Condvar, Mutex, RwLock const constructors work with unsupported impl
1 parent fc96600 commit 513eda0

File tree

7 files changed

+7
-0
lines changed

7 files changed

+7
-0
lines changed

library/std/src/sys/unsupported/locks/condvar.rs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub type MovableCondvar = Condvar;
77

88
impl Condvar {
99
#[inline]
10+
#[rustc_const_stable(feature = "const_locks", since = "1.63.0")]
1011
pub const fn new() -> Condvar {
1112
Condvar {}
1213
}

library/std/src/sys/unsupported/locks/mutex.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ unsafe impl Sync for Mutex {} // no threads on this platform
1212

1313
impl Mutex {
1414
#[inline]
15+
#[rustc_const_stable(feature = "const_locks", since = "1.63.0")]
1516
pub const fn new() -> Mutex {
1617
Mutex { locked: Cell::new(false) }
1718
}

library/std/src/sys/unsupported/locks/rwlock.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ unsafe impl Sync for RwLock {} // no threads on this platform
1212

1313
impl RwLock {
1414
#[inline]
15+
#[rustc_const_stable(feature = "const_locks", since = "1.63.0")]
1516
pub const fn new() -> RwLock {
1617
RwLock { mode: Cell::new(0) }
1718
}

library/std/src/sys_common/condvar.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub struct Condvar {
1515
impl Condvar {
1616
/// Creates a new condition variable for use.
1717
#[inline]
18+
#[rustc_const_stable(feature = "const_locks", since = "1.63.0")]
1819
pub const fn new() -> Self {
1920
Self { inner: imp::MovableCondvar::new(), check: CondvarCheck::new() }
2021
}

library/std/src/sys_common/condvar/check.rs

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pub struct NoCheck;
5050

5151
#[allow(dead_code)]
5252
impl NoCheck {
53+
#[rustc_const_stable(feature = "const_locks", since = "1.63.0")]
5354
pub const fn new() -> Self {
5455
Self
5556
}

library/std/src/sys_common/mutex.rs

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ unsafe impl Sync for MovableMutex {}
6161
impl MovableMutex {
6262
/// Creates a new mutex.
6363
#[inline]
64+
#[rustc_const_stable(feature = "const_locks", since = "1.63.0")]
6465
pub const fn new() -> Self {
6566
Self(imp::MovableMutex::new())
6667
}

library/std/src/sys_common/rwlock.rs

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ pub struct MovableRwLock(imp::MovableRwLock);
7575
impl MovableRwLock {
7676
/// Creates a new reader-writer lock for use.
7777
#[inline]
78+
#[rustc_const_stable(feature = "const_locks", since = "1.63.0")]
7879
pub const fn new() -> Self {
7980
Self(imp::MovableRwLock::new())
8081
}

0 commit comments

Comments
 (0)