Skip to content

Commit

Permalink
Make Barrier::new() const
Browse files Browse the repository at this point in the history
  • Loading branch information
Jules-Bertholet committed Jan 3, 2024
1 parent e51e98d commit 3c9aa69
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 3c9aa69

Please sign in to comment.