Skip to content

Commit 8f359be

Browse files
committed
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
2 parents 2dbd623 + 3c9aa69 commit 8f359be

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

library/std/src/sync/barrier.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,10 @@ impl Barrier {
8181
/// let barrier = Barrier::new(10);
8282
/// ```
8383
#[stable(feature = "rust1", since = "1.0.0")]
84+
#[rustc_const_stable(feature = "const_barrier", since = "CURRENT_RUSTC_VERSION")]
8485
#[must_use]
85-
pub fn new(n: usize) -> Barrier {
86+
#[inline]
87+
pub const fn new(n: usize) -> Barrier {
8688
Barrier {
8789
lock: Mutex::new(BarrierState { count: 0, generation_id: 0 }),
8890
cvar: Condvar::new(),

0 commit comments

Comments
 (0)