Skip to content

Commit

Permalink
Auto merge of rust-lang#119536 - Jules-Bertholet:const-barrier, r=dto…
Browse files Browse the repository at this point in the history
…lnay

Make `Barrier::new()` const

I guess this was just missed in rust-lang#97791?

`@rustbot` label T-libs-api -T-libs
  • Loading branch information
bors committed Feb 23, 2024
2 parents 2dbd623 + 3c9aa69 commit 8f359be
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion library/std/src/sync/barrier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ impl Barrier {
/// let barrier = Barrier::new(10);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_barrier", since = "CURRENT_RUSTC_VERSION")]
#[must_use]
pub fn new(n: usize) -> Barrier {
#[inline]
pub const fn new(n: usize) -> Barrier {
Barrier {
lock: Mutex::new(BarrierState { count: 0, generation_id: 0 }),
cvar: Condvar::new(),
Expand Down

0 comments on commit 8f359be

Please sign in to comment.