@@ -235,8 +235,7 @@ unsafe impl<T: ?Sized + Sync> Sync for MutexGuard<'_, T> {}
235
235
#[ must_not_suspend = "holding a MappedMutexGuard across suspend \
236
236
points can cause deadlocks, delays, \
237
237
and cause Futures to not implement `Send`"]
238
- // #[unstable(feature = "mapped_lock_guards", issue = "117108")]
239
- #[ unstable( feature = "nonpoison_mutex" , issue = "134645" ) ]
238
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108" ) ]
240
239
#[ clippy:: has_significant_drop]
241
240
pub struct MappedMutexGuard < ' a , T : ?Sized + ' a > {
242
241
// NB: we use a pointer instead of `&'a mut T` to avoid `noalias` violations, because a
@@ -248,11 +247,9 @@ pub struct MappedMutexGuard<'a, T: ?Sized + 'a> {
248
247
_variance : PhantomData < & ' a mut T > ,
249
248
}
250
249
251
- // #[unstable(feature = "mapped_lock_guards", issue = "117108")]
252
- #[ unstable( feature = "nonpoison_mutex" , issue = "134645" ) ]
250
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108" ) ]
253
251
impl < T : ?Sized > !Send for MappedMutexGuard < ' _ , T > { }
254
- // #[unstable(feature = "mapped_lock_guards", issue = "117108")]
255
- #[ unstable( feature = "nonpoison_mutex" , issue = "134645" ) ]
252
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108" ) ]
256
253
unsafe impl < T : ?Sized + Sync > Sync for MappedMutexGuard < ' _ , T > { }
257
254
258
255
impl < T > Mutex < T > {
@@ -272,7 +269,7 @@ impl<T> Mutex<T> {
272
269
Mutex { inner : sys:: Mutex :: new ( ) , data : UnsafeCell :: new ( t) }
273
270
}
274
271
275
- // FIXME(connor) : Add `lock_value_accessors` feature methods.
272
+ // FIXME: Add `lock_value_accessors` feature methods.
276
273
}
277
274
278
275
impl < T : ?Sized > Mutex < T > {
@@ -392,7 +389,7 @@ impl<T: ?Sized> Mutex<T> {
392
389
self . data . get_mut ( )
393
390
}
394
391
395
- // FIXME(connor) : Add `mutex_data_ptr` feature method.
392
+ // FIXME: Add `mutex_data_ptr` feature method.
396
393
}
397
394
398
395
#[ unstable( feature = "nonpoison_mutex" , issue = "134645" ) ]
@@ -483,8 +480,7 @@ impl<'a, T: ?Sized> MutexGuard<'a, T> {
483
480
/// This is an associated function that needs to be used as
484
481
/// `MutexGuard::map(...)`. A method would interfere with methods of the
485
482
/// same name on the contents of the `MutexGuard` used through `Deref`.
486
- // #[unstable(feature = "mapped_lock_guards", issue = "117108")]
487
- #[ unstable( feature = "nonpoison_mutex" , issue = "134645" ) ]
483
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108" ) ]
488
484
pub fn map < U , F > ( orig : Self , f : F ) -> MappedMutexGuard < ' a , U >
489
485
where
490
486
F : FnOnce ( & mut T ) -> & mut U ,
@@ -509,8 +505,7 @@ impl<'a, T: ?Sized> MutexGuard<'a, T> {
509
505
/// `MutexGuard::try_map(...)`. A method would interfere with methods of the
510
506
/// same name on the contents of the `MutexGuard` used through `Deref`.
511
507
#[ doc( alias = "filter_map" ) ]
512
- // #[unstable(feature = "mapped_lock_guards", issue = "117108")]
513
- #[ unstable( feature = "nonpoison_mutex" , issue = "134645" ) ]
508
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108" ) ]
514
509
pub fn try_map < U , F > ( orig : Self , f : F ) -> Result < MappedMutexGuard < ' a , U > , Self >
515
510
where
516
511
F : FnOnce ( & mut T ) -> Option < & mut U > ,
@@ -531,8 +526,7 @@ impl<'a, T: ?Sized> MutexGuard<'a, T> {
531
526
}
532
527
}
533
528
534
- // #[unstable(feature = "mapped_lock_guards", issue = "117108")]
535
- #[ unstable( feature = "nonpoison_mutex" , issue = "134645" ) ]
529
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108" ) ]
536
530
impl < T : ?Sized > Deref for MappedMutexGuard < ' _ , T > {
537
531
type Target = T ;
538
532
@@ -541,16 +535,14 @@ impl<T: ?Sized> Deref for MappedMutexGuard<'_, T> {
541
535
}
542
536
}
543
537
544
- // #[unstable(feature = "mapped_lock_guards", issue = "117108")]
545
- #[ unstable( feature = "nonpoison_mutex" , issue = "134645" ) ]
538
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108" ) ]
546
539
impl < T : ?Sized > DerefMut for MappedMutexGuard < ' _ , T > {
547
540
fn deref_mut ( & mut self ) -> & mut T {
548
541
unsafe { self . data . as_mut ( ) }
549
542
}
550
543
}
551
544
552
- // #[unstable(feature = "mapped_lock_guards", issue = "117108")]
553
- #[ unstable( feature = "nonpoison_mutex" , issue = "134645" ) ]
545
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108" ) ]
554
546
impl < T : ?Sized > Drop for MappedMutexGuard < ' _ , T > {
555
547
#[ inline]
556
548
fn drop ( & mut self ) {
@@ -560,16 +552,14 @@ impl<T: ?Sized> Drop for MappedMutexGuard<'_, T> {
560
552
}
561
553
}
562
554
563
- // #[unstable(feature = "mapped_lock_guards", issue = "117108")]
564
- #[ unstable( feature = "nonpoison_mutex" , issue = "134645" ) ]
555
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108" ) ]
565
556
impl < T : ?Sized + fmt:: Debug > fmt:: Debug for MappedMutexGuard < ' _ , T > {
566
557
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
567
558
fmt:: Debug :: fmt ( & * * self , f)
568
559
}
569
560
}
570
561
571
- // #[unstable(feature = "mapped_lock_guards", issue = "117108")]
572
- #[ unstable( feature = "nonpoison_mutex" , issue = "134645" ) ]
562
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108" ) ]
573
563
impl < T : ?Sized + fmt:: Display > fmt:: Display for MappedMutexGuard < ' _ , T > {
574
564
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
575
565
( * * self ) . fmt ( f)
@@ -585,15 +575,14 @@ impl<'a, T: ?Sized> MappedMutexGuard<'a, T> {
585
575
/// This is an associated function that needs to be used as
586
576
/// `MappedMutexGuard::map(...)`. A method would interfere with methods of the
587
577
/// same name on the contents of the `MutexGuard` used through `Deref`.
588
- // #[unstable(feature = "mapped_lock_guards", issue = "117108")]
589
- #[ unstable( feature = "nonpoison_mutex" , issue = "134645" ) ]
578
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108" ) ]
590
579
pub fn map < U , F > ( mut orig : Self , f : F ) -> MappedMutexGuard < ' a , U >
591
580
where
592
581
F : FnOnce ( & mut T ) -> & mut U ,
593
582
U : ?Sized ,
594
583
{
595
584
// SAFETY: the conditions of `MutexGuard::new` were satisfied when the original guard
596
- // was created, and have been upheld throughout `map` and/or `try_map `.
585
+ // was created, and have been upheld throughout `map` and/or `filter_map `.
597
586
// The signature of the closure guarantees that it will not "leak" the lifetime of the reference
598
587
// passed to it. If the closure panics, the guard will be dropped.
599
588
let data = NonNull :: from ( f ( unsafe { orig. data . as_mut ( ) } ) ) ;
@@ -608,17 +597,16 @@ impl<'a, T: ?Sized> MappedMutexGuard<'a, T> {
608
597
/// The `Mutex` is already locked, so this cannot fail.
609
598
///
610
599
/// This is an associated function that needs to be used as
611
- /// `MappedMutexGuard::try_map (...)`. A method would interfere with methods of the
600
+ /// `MappedMutexGuard::filter_map (...)`. A method would interfere with methods of the
612
601
/// same name on the contents of the `MutexGuard` used through `Deref`.
613
- #[ doc( alias = "filter_map" ) ]
614
- #[ unstable( feature = "nonpoison_mutex" , issue = "134645" ) ]
615
- pub fn try_map < U , F > ( mut orig : Self , f : F ) -> Result < MappedMutexGuard < ' a , U > , Self >
602
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108" ) ]
603
+ pub fn filter_map < U , F > ( mut orig : Self , f : F ) -> Result < MappedMutexGuard < ' a , U > , Self >
616
604
where
617
605
F : FnOnce ( & mut T ) -> Option < & mut U > ,
618
606
U : ?Sized ,
619
607
{
620
608
// SAFETY: the conditions of `MutexGuard::new` were satisfied when the original guard
621
- // was created, and have been upheld throughout `map` and/or `try_map `.
609
+ // was created, and have been upheld throughout `map` and/or `filter_map `.
622
610
// The signature of the closure guarantees that it will not "leak" the lifetime of the reference
623
611
// passed to it. If the closure panics, the guard will be dropped.
624
612
match f ( unsafe { orig. data . as_mut ( ) } ) {
0 commit comments