@@ -125,7 +125,7 @@ unsafe impl Send for Once {}
125
125
126
126
/// State yielded to [`Once::call_once_force()`]’s closure parameter. The state
127
127
/// can be used to query the poison status of the [`Once`].
128
- #[ unstable ( feature = "once_poison" , issue = "33577 " ) ]
128
+ #[ stable ( feature = "once_poison" , since = "1.51.0 " ) ]
129
129
#[ derive( Debug ) ]
130
130
pub struct OnceState {
131
131
poisoned : bool ,
@@ -280,8 +280,6 @@ impl Once {
280
280
/// # Examples
281
281
///
282
282
/// ```
283
- /// #![feature(once_poison)]
284
- ///
285
283
/// use std::sync::Once;
286
284
/// use std::thread;
287
285
///
@@ -301,13 +299,13 @@ impl Once {
301
299
///
302
300
/// // call_once_force will still run and reset the poisoned state
303
301
/// INIT.call_once_force(|state| {
304
- /// assert!(state.poisoned ());
302
+ /// assert!(state.is_poisoned ());
305
303
/// });
306
304
///
307
305
/// // once any success happens, we stop propagating the poison
308
306
/// INIT.call_once(|| {});
309
307
/// ```
310
- #[ unstable ( feature = "once_poison" , issue = "33577 " ) ]
308
+ #[ stable ( feature = "once_poison" , since = "1.51.0 " ) ]
311
309
pub fn call_once_force < F > ( & self , f : F )
312
310
where
313
311
F : FnOnce ( & OnceState ) ,
@@ -526,8 +524,6 @@ impl OnceState {
526
524
/// A poisoned [`Once`]:
527
525
///
528
526
/// ```
529
- /// #![feature(once_poison)]
530
- ///
531
527
/// use std::sync::Once;
532
528
/// use std::thread;
533
529
///
@@ -540,24 +536,22 @@ impl OnceState {
540
536
/// assert!(handle.join().is_err());
541
537
///
542
538
/// INIT.call_once_force(|state| {
543
- /// assert!(state.poisoned ());
539
+ /// assert!(state.is_poisoned ());
544
540
/// });
545
541
/// ```
546
542
///
547
543
/// An unpoisoned [`Once`]:
548
544
///
549
545
/// ```
550
- /// #![feature(once_poison)]
551
- ///
552
546
/// use std::sync::Once;
553
547
///
554
548
/// static INIT: Once = Once::new();
555
549
///
556
550
/// INIT.call_once_force(|state| {
557
- /// assert!(!state.poisoned ());
551
+ /// assert!(!state.is_poisoned ());
558
552
/// });
559
- #[ unstable ( feature = "once_poison" , issue = "33577 " ) ]
560
- pub fn poisoned ( & self ) -> bool {
553
+ #[ stable ( feature = "once_poison" , since = "1.51.0 " ) ]
554
+ pub fn is_poisoned ( & self ) -> bool {
561
555
self . poisoned
562
556
}
563
557
0 commit comments