about summary refs log tree commit diff
path: root/library/std/src/sync/barrier.rs
diff options
context:
space:
mode:
authorJules Bertholet <julesbertholet@quoi.xyz>2024-01-02 21:35:34 -0500
committerJules Bertholet <julesbertholet@quoi.xyz>2024-01-02 21:42:10 -0500
commit3c9aa691471943e9a391e1445d4a4b699ee444ea (patch)
treecc7d6d283a3affb1b741c400d117fa535a00fd74 /library/std/src/sync/barrier.rs
parente51e98dde6a60637b6a71b8105245b629ac3fe77 (diff)
downloadrust-3c9aa691471943e9a391e1445d4a4b699ee444ea.tar.gz
rust-3c9aa691471943e9a391e1445d4a4b699ee444ea.zip
Make `Barrier::new()` const
Diffstat (limited to 'library/std/src/sync/barrier.rs')
-rw-r--r--library/std/src/sync/barrier.rs4
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(),