diff options
| author | bors <bors@rust-lang.org> | 2024-02-23 20:54:02 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-02-23 20:54:02 +0000 |
| commit | 8f359beca4e58bc3ae795a666301a8f47023044c (patch) | |
| tree | f07a040a4d878a9e002c05c1d5077c3ebb9897a8 | |
| parent | 2dbd6233ccdb2cd4b621a5e839a95c3fbbc0c375 (diff) | |
| parent | 3c9aa691471943e9a391e1445d4a4b699ee444ea (diff) | |
| download | rust-8f359beca4e58bc3ae795a666301a8f47023044c.tar.gz rust-8f359beca4e58bc3ae795a666301a8f47023044c.zip | |
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
| -rw-r--r-- | library/std/src/sync/barrier.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/library/std/src/sync/barrier.rs b/library/std/src/sync/barrier.rs index ed3c5512084..764fa284794 100644 --- a/library/std/src/sync/barrier.rs +++ b/library/std/src/sync/barrier.rs @@ -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(), |
