File tree 2 files changed +4
-6
lines changed
2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -924,19 +924,18 @@ impl<T> Weak<T> {
924
924
///
925
925
/// use std::sync::Arc;
926
926
///
927
- /// let five = Arc ::new(5 );
927
+ /// let empty: Weak<i64> = Weak ::new();
928
928
/// ```
929
929
#[ unstable( feature = "downgraded_weak" ,
930
930
reason = "recently added" ,
931
931
issue = "30425" ) ]
932
932
pub fn new ( ) -> Weak < T > {
933
933
unsafe {
934
- let x : Box < _ > = box ArcInner {
934
+ Weak { _ptr : Shared :: new ( Box :: into_raw ( box ArcInner {
935
935
strong : atomic:: AtomicUsize :: new ( 0 ) ,
936
936
weak : atomic:: AtomicUsize :: new ( 1 ) ,
937
937
data : uninitialized ( ) ,
938
- } ;
939
- Weak { _ptr : Shared :: new ( Box :: into_raw ( x) ) }
938
+ } ) ) }
940
939
}
941
940
}
942
941
}
Original file line number Diff line number Diff line change @@ -843,9 +843,8 @@ impl<T> Weak<T> {
843
843
///
844
844
/// use std::rc::Weak;
845
845
///
846
- /// let empty:Weak<i64> = Weak::new();
846
+ /// let empty: Weak<i64> = Weak::new();
847
847
/// ```
848
-
849
848
#[ unstable( feature = "downgraded_weak" ,
850
849
reason = "recently added" ,
851
850
issue="30425" ) ]
You can’t perform that action at this time.
0 commit comments