@@ -158,7 +158,7 @@ unsafe impl<T: ?Sized + Sync> Sync for RwLockWriteGuard<'_, T> {}
158
158
#[ must_not_suspend = "holding a MappedRwLockReadGuard across suspend \
159
159
points can cause deadlocks, delays, \
160
160
and cause Futures to not implement `Send`"]
161
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
161
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
162
162
#[ clippy:: has_significant_drop]
163
163
pub struct MappedRwLockReadGuard < ' a , T : ?Sized + ' a > {
164
164
// NB: we use a pointer instead of `&'a T` to avoid `noalias` violations, because a
@@ -169,10 +169,10 @@ pub struct MappedRwLockReadGuard<'a, T: ?Sized + 'a> {
169
169
inner_lock : & ' a sys:: RwLock ,
170
170
}
171
171
172
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
172
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
173
173
impl < T : ?Sized > !Send for MappedRwLockReadGuard < ' _ , T > { }
174
174
175
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
175
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
176
176
unsafe impl < T : ?Sized + Sync > Sync for MappedRwLockReadGuard < ' _ , T > { }
177
177
178
178
/// RAII structure used to release the exclusive write access of a lock when
@@ -187,20 +187,24 @@ unsafe impl<T: ?Sized + Sync> Sync for MappedRwLockReadGuard<'_, T> {}
187
187
#[ must_not_suspend = "holding a MappedRwLockWriteGuard across suspend \
188
188
points can cause deadlocks, delays, \
189
189
and cause Future's to not implement `Send`"]
190
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
190
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
191
191
#[ clippy:: has_significant_drop]
192
192
pub struct MappedRwLockWriteGuard < ' a , T : ?Sized + ' a > {
193
+ // NB: we use a pointer instead of `&'a mut T` to avoid `noalias` violations, because a
194
+ // `MappedRwLockWriteGuard` argument doesn't hold uniqueness for its whole scope, only until it drops.
195
+ // `NonNull` is covariant over `T`, so we add a `PhantomData<&'a mut T>` field
196
+ // below for the correct variance over `T` (invariance).
193
197
data : NonNull < T > ,
194
198
inner_lock : & ' a sys:: RwLock ,
195
199
poison_flag : & ' a poison:: Flag ,
196
200
poison : poison:: Guard ,
197
201
_variance : PhantomData < & ' a mut T > ,
198
202
}
199
203
200
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
204
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
201
205
impl < T : ?Sized > !Send for MappedRwLockWriteGuard < ' _ , T > { }
202
206
203
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
207
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
204
208
unsafe impl < T : ?Sized + Sync > Sync for MappedRwLockWriteGuard < ' _ , T > { }
205
209
206
210
impl < T > RwLock < T > {
@@ -621,28 +625,28 @@ impl<T: ?Sized + fmt::Display> fmt::Display for RwLockWriteGuard<'_, T> {
621
625
}
622
626
}
623
627
624
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
628
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
625
629
impl < T : ?Sized + fmt:: Debug > fmt:: Debug for MappedRwLockReadGuard < ' _ , T > {
626
630
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
627
631
( * * self ) . fmt ( f)
628
632
}
629
633
}
630
634
631
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
635
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
632
636
impl < T : ?Sized + fmt:: Display > fmt:: Display for MappedRwLockReadGuard < ' _ , T > {
633
637
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
634
638
( * * self ) . fmt ( f)
635
639
}
636
640
}
637
641
638
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
642
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
639
643
impl < T : ?Sized + fmt:: Debug > fmt:: Debug for MappedRwLockWriteGuard < ' _ , T > {
640
644
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
641
645
( * * self ) . fmt ( f)
642
646
}
643
647
}
644
648
645
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
649
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
646
650
impl < T : ?Sized + fmt:: Display > fmt:: Display for MappedRwLockWriteGuard < ' _ , T > {
647
651
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
648
652
( * * self ) . fmt ( f)
@@ -677,7 +681,7 @@ impl<T: ?Sized> DerefMut for RwLockWriteGuard<'_, T> {
677
681
}
678
682
}
679
683
680
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
684
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
681
685
impl < T : ?Sized > Deref for MappedRwLockReadGuard < ' _ , T > {
682
686
type Target = T ;
683
687
@@ -688,7 +692,7 @@ impl<T: ?Sized> Deref for MappedRwLockReadGuard<'_, T> {
688
692
}
689
693
}
690
694
691
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
695
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
692
696
impl < T : ?Sized > Deref for MappedRwLockWriteGuard < ' _ , T > {
693
697
type Target = T ;
694
698
@@ -699,7 +703,7 @@ impl<T: ?Sized> Deref for MappedRwLockWriteGuard<'_, T> {
699
703
}
700
704
}
701
705
702
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
706
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
703
707
impl < T : ?Sized > DerefMut for MappedRwLockWriteGuard < ' _ , T > {
704
708
fn deref_mut ( & mut self ) -> & mut T {
705
709
// SAFETY: the conditions of `RwLockWriteGuard::new` were satisfied when the original guard
@@ -729,7 +733,7 @@ impl<T: ?Sized> Drop for RwLockWriteGuard<'_, T> {
729
733
}
730
734
}
731
735
732
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
736
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
733
737
impl < T : ?Sized > Drop for MappedRwLockReadGuard < ' _ , T > {
734
738
fn drop ( & mut self ) {
735
739
// SAFETY: the conditions of `RwLockReadGuard::new` were satisfied when the original guard
@@ -740,7 +744,7 @@ impl<T: ?Sized> Drop for MappedRwLockReadGuard<'_, T> {
740
744
}
741
745
}
742
746
743
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
747
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
744
748
impl < T : ?Sized > Drop for MappedRwLockWriteGuard < ' _ , T > {
745
749
fn drop ( & mut self ) {
746
750
self . poison_flag . done ( & self . poison ) ;
@@ -762,7 +766,7 @@ impl<'a, T: ?Sized> RwLockReadGuard<'a, T> {
762
766
/// `RwLockReadGuard::map(...)`. A method would interfere with methods of
763
767
/// the same name on the contents of the `RwLockReadGuard` used through
764
768
/// `Deref`.
765
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
769
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
766
770
pub fn map < U , F > ( orig : Self , f : F ) -> MappedRwLockReadGuard < ' a , U >
767
771
where
768
772
F : FnOnce ( & T ) -> & U ,
@@ -784,7 +788,7 @@ impl<'a, T: ?Sized> RwLockReadGuard<'a, T> {
784
788
/// of the same name on the contents of the `RwLockReadGuard` used through
785
789
/// `Deref`.
786
790
#[ doc( alias = "filter_map" ) ]
787
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
791
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
788
792
pub fn try_map < U , F > ( orig : Self , f : F ) -> Result < MappedRwLockReadGuard < ' a , U > , Self >
789
793
where
790
794
F : FnOnce ( & T ) -> Option < & U > ,
@@ -808,7 +812,7 @@ impl<'a, T: ?Sized> MappedRwLockReadGuard<'a, T> {
808
812
/// `MappedRwLockReadGuard::map(...)`. A method would interfere with
809
813
/// methods of the same name on the contents of the `MappedRwLockReadGuard`
810
814
/// used through `Deref`.
811
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
815
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
812
816
pub fn map < U , F > ( orig : Self , f : F ) -> MappedRwLockReadGuard < ' a , U >
813
817
where
814
818
F : FnOnce ( & T ) -> & U ,
@@ -830,7 +834,7 @@ impl<'a, T: ?Sized> MappedRwLockReadGuard<'a, T> {
830
834
/// methods of the same name on the contents of the `MappedRwLockReadGuard`
831
835
/// used through `Deref`.
832
836
#[ doc( alias = "filter_map" ) ]
833
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
837
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
834
838
pub fn try_map < U , F > ( orig : Self , f : F ) -> Result < MappedRwLockReadGuard < ' a , U > , Self >
835
839
where
836
840
F : FnOnce ( & T ) -> Option < & U > ,
@@ -854,7 +858,7 @@ impl<'a, T: ?Sized> RwLockWriteGuard<'a, T> {
854
858
/// `RwLockWriteGuard::map(...)`. A method would interfere with methods of
855
859
/// the same name on the contents of the `RwLockWriteGuard` used through
856
860
/// `Deref`.
857
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
861
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
858
862
pub fn map < U , F > ( orig : Self , f : F ) -> MappedRwLockWriteGuard < ' a , U >
859
863
where
860
864
F : FnOnce ( & mut T ) -> & mut U ,
@@ -882,7 +886,7 @@ impl<'a, T: ?Sized> RwLockWriteGuard<'a, T> {
882
886
/// of the same name on the contents of the `RwLockWriteGuard` used through
883
887
/// `Deref`.
884
888
#[ doc( alias = "filter_map" ) ]
885
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
889
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
886
890
pub fn try_map < U , F > ( orig : Self , f : F ) -> Result < MappedRwLockWriteGuard < ' a , U > , Self >
887
891
where
888
892
F : FnOnce ( & mut T ) -> Option < & mut U > ,
@@ -912,7 +916,7 @@ impl<'a, T: ?Sized> MappedRwLockWriteGuard<'a, T> {
912
916
/// `MappedRwLockWriteGuard::map(...)`. A method would interfere with
913
917
/// methods of the same name on the contents of the `MappedRwLockWriteGuard`
914
918
/// used through `Deref`.
915
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
919
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
916
920
pub fn map < U , F > ( orig : Self , f : F ) -> MappedRwLockWriteGuard < ' a , U >
917
921
where
918
922
F : FnOnce ( & mut T ) -> & mut U ,
@@ -940,7 +944,7 @@ impl<'a, T: ?Sized> MappedRwLockWriteGuard<'a, T> {
940
944
/// methods of the same name on the contents of the `MappedRwLockWriteGuard`
941
945
/// used through `Deref`.
942
946
#[ doc( alias = "filter_map" ) ]
943
- #[ unstable( feature = "mapped_lock_guards" , issue = "none " ) ]
947
+ #[ unstable( feature = "mapped_lock_guards" , issue = "117108 " ) ]
944
948
pub fn try_map < U , F > ( orig : Self , f : F ) -> Result < MappedRwLockWriteGuard < ' a , U > , Self >
945
949
where
946
950
F : FnOnce ( & mut T ) -> Option < & mut U > ,
0 commit comments