Auto merge of #119536 - Jules-Bertholet:const-barrier, r=dtolnay
Make `Barrier::new()` const I guess this was just missed in #97791? `@rustbot` label T-libs-api -T-libs
This commit is contained in:
commit
8f359beca4
@ -81,8 +81,10 @@ impl Barrier {
|
|||||||
/// let barrier = Barrier::new(10);
|
/// let barrier = Barrier::new(10);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
#[rustc_const_stable(feature = "const_barrier", since = "CURRENT_RUSTC_VERSION")]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn new(n: usize) -> Barrier {
|
#[inline]
|
||||||
|
pub const fn new(n: usize) -> Barrier {
|
||||||
Barrier {
|
Barrier {
|
||||||
lock: Mutex::new(BarrierState { count: 0, generation_id: 0 }),
|
lock: Mutex::new(BarrierState { count: 0, generation_id: 0 }),
|
||||||
cvar: Condvar::new(),
|
cvar: Condvar::new(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user