File tree 2 files changed +6
-4
lines changed
2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -952,8 +952,9 @@ impl<T: ?Sized> Rc<T> {
952
952
#[ inline]
953
953
#[ unstable( feature = "rc_as_weak" , issue = "100472" ) ]
954
954
#[ must_use]
955
- pub const fn as_weak < ' a > ( this : & ' a Self ) -> & ' a Weak < T > {
956
- unsafe { mem:: transmute :: < & ' a Rc < T > , & ' a Weak < T > > ( this) }
955
+ pub const fn as_weak ( this : & Self ) -> & Weak < T > {
956
+ let weak = this as * const Self as * const Weak < T > ;
957
+ unsafe { & * weak }
957
958
}
958
959
959
960
/// Gets the number of [`Weak`] pointers to this allocation.
Original file line number Diff line number Diff line change @@ -979,8 +979,9 @@ impl<T: ?Sized> Arc<T> {
979
979
#[ inline]
980
980
#[ unstable( feature = "rc_as_weak" , issue = "100472" ) ]
981
981
#[ must_use]
982
- pub const fn as_weak < ' a > ( this : & ' a Self ) -> & ' a Weak < T > {
983
- unsafe { mem:: transmute :: < & ' a Arc < T > , & ' a Weak < T > > ( this) }
982
+ pub const fn as_weak ( this : & Self ) -> & Weak < T > {
983
+ let weak = this as * const Self as * const Weak < T > ;
984
+ unsafe { & * weak }
984
985
}
985
986
986
987
/// Gets the number of [`Weak`] pointers to this allocation.
You can’t perform that action at this time.
0 commit comments