File tree 6 files changed +63
-11
lines changed
6 files changed +63
-11
lines changed Original file line number Diff line number Diff line change @@ -181,7 +181,10 @@ impl Semaphore {
181
181
///
182
182
/// If the specified number of permits exceeds the maximum permit amount
183
183
/// Then the value will get clamped to the maximum number of permits.
184
- #[ cfg( all( feature = "parking_lot" , not( all( loom, test) ) ) ) ]
184
+ #[ cfg( all(
185
+ any( feature = "parking_lot" , not( tokio_no_const_mutex_new) ) ,
186
+ not( all( loom, test) )
187
+ ) ) ]
185
188
pub ( crate ) const fn const_new ( mut permits : usize ) -> Self {
186
189
// NOTE: assertions and by extension panics are still being worked on: https://github.com/rust-lang/rust/issues/74925
187
190
// currently we just clamp the permit count when it exceeds the max
Original file line number Diff line number Diff line change @@ -378,8 +378,18 @@ impl<T: ?Sized> Mutex<T> {
378
378
///
379
379
/// static LOCK: Mutex<i32> = Mutex::const_new(5);
380
380
/// ```
381
- #[ cfg( all( feature = "parking_lot" , not( all( loom, test) ) , ) ) ]
382
- #[ cfg_attr( docsrs, doc( cfg( feature = "parking_lot" ) ) ) ]
381
+ ///
382
+ /// NOTE that this function is available if your rust compiler
383
+ /// is newer than 1.63 and does not specify `--cfg tokio_no_const_mutex_new`
384
+ /// or if you enabled feature `parking_lot`.
385
+ #[ cfg( all(
386
+ any( feature = "parking_lot" , not( tokio_no_const_mutex_new) ) ,
387
+ not( all( loom, test) )
388
+ ) ) ]
389
+ #[ cfg_attr(
390
+ docsrs,
391
+ doc( cfg( any( feature = "parking_lot" , not( tokio_no_const_mutex_new) ) ) )
392
+ ) ]
383
393
pub const fn const_new ( t : T ) -> Self
384
394
where
385
395
T : Sized ,
Original file line number Diff line number Diff line change @@ -443,8 +443,18 @@ impl Notify {
443
443
///
444
444
/// static NOTIFY: Notify = Notify::const_new();
445
445
/// ```
446
- #[ cfg( all( feature = "parking_lot" , not( all( loom, test) ) ) ) ]
447
- #[ cfg_attr( docsrs, doc( cfg( feature = "parking_lot" ) ) ) ]
446
+ ///
447
+ /// NOTE that this function is available if your rust compiler
448
+ /// is newer than 1.63 and does not specify `--cfg tokio_no_const_mutex_new`
449
+ /// or if you enabled feature `parking_lot`.
450
+ #[ cfg( all(
451
+ any( feature = "parking_lot" , not( tokio_no_const_mutex_new) ) ,
452
+ not( all( loom, test) )
453
+ ) ) ]
454
+ #[ cfg_attr(
455
+ docsrs,
456
+ doc( cfg( any( feature = "parking_lot" , not( tokio_no_const_mutex_new) ) ) )
457
+ ) ]
448
458
pub const fn const_new ( ) -> Notify {
449
459
Notify {
450
460
state : AtomicUsize :: new ( 0 ) ,
Original file line number Diff line number Diff line change @@ -171,8 +171,18 @@ impl<T> OnceCell<T> {
171
171
/// assert_eq!(*result, 2);
172
172
/// }
173
173
/// ```
174
- #[ cfg( all( feature = "parking_lot" , not( all( loom, test) ) ) ) ]
175
- #[ cfg_attr( docsrs, doc( cfg( feature = "parking_lot" ) ) ) ]
174
+ ///
175
+ /// NOTE that this function is available if your rust compiler
176
+ /// is newer than 1.63 and does not specify `--cfg tokio_no_const_mutex_new`
177
+ /// or if you enabled feature `parking_lot`.
178
+ #[ cfg( all(
179
+ any( feature = "parking_lot" , not( tokio_no_const_mutex_new) ) ,
180
+ not( all( loom, test) )
181
+ ) ) ]
182
+ #[ cfg_attr(
183
+ docsrs,
184
+ doc( cfg( any( feature = "parking_lot" , not( tokio_no_const_mutex_new) ) ) )
185
+ ) ]
176
186
pub const fn const_new ( ) -> Self {
177
187
OnceCell {
178
188
value_set : AtomicBool :: new ( false ) ,
Original file line number Diff line number Diff line change @@ -334,8 +334,18 @@ impl<T: ?Sized> RwLock<T> {
334
334
///
335
335
/// static LOCK: RwLock<i32> = RwLock::const_new(5);
336
336
/// ```
337
- #[ cfg( all( feature = "parking_lot" , not( all( loom, test) ) ) ) ]
338
- #[ cfg_attr( docsrs, doc( cfg( feature = "parking_lot" ) ) ) ]
337
+ ///
338
+ /// NOTE that this function is available if your rust compiler
339
+ /// is newer than 1.63 and does not specify `--cfg tokio_no_const_mutex_new`
340
+ /// or if you enabled feature `parking_lot`.
341
+ #[ cfg( all(
342
+ any( feature = "parking_lot" , not( tokio_no_const_mutex_new) ) ,
343
+ not( all( loom, test) )
344
+ ) ) ]
345
+ #[ cfg_attr(
346
+ docsrs,
347
+ doc( cfg( any( feature = "parking_lot" , not( tokio_no_const_mutex_new) ) ) )
348
+ ) ]
339
349
pub const fn const_new ( value : T ) -> RwLock < T >
340
350
where
341
351
T : Sized ,
Original file line number Diff line number Diff line change @@ -173,8 +173,17 @@ impl Semaphore {
173
173
/// static SEM: Semaphore = Semaphore::const_new(10);
174
174
/// ```
175
175
///
176
- #[ cfg( all( feature = "parking_lot" , not( all( loom, test) ) ) ) ]
177
- #[ cfg_attr( docsrs, doc( cfg( feature = "parking_lot" ) ) ) ]
176
+ /// NOTE that this function is available if your rust compiler
177
+ /// is newer than 1.63 and does not specify `--cfg tokio_no_const_mutex_new`
178
+ /// or if you enabled feature `parking_lot`.
179
+ #[ cfg( all(
180
+ any( feature = "parking_lot" , not( tokio_no_const_mutex_new) ) ,
181
+ not( all( loom, test) )
182
+ ) ) ]
183
+ #[ cfg_attr(
184
+ docsrs,
185
+ doc( cfg( any( feature = "parking_lot" , not( tokio_no_const_mutex_new) ) ) )
186
+ ) ]
178
187
pub const fn const_new ( permits : usize ) -> Self {
179
188
#[ cfg( all( tokio_unstable, feature = "tracing" ) ) ]
180
189
return Self {
You can’t perform that action at this time.
0 commit comments