File tree Expand file tree Collapse file tree 2 files changed +1
-36
lines changed Expand file tree Collapse file tree 2 files changed +1
-36
lines changed Original file line number Diff line number Diff line change @@ -540,7 +540,7 @@ impl<T> Arc<T> {
540540 ///
541541 /// The similar expression `Arc::try_unwrap(this).ok()` does not
542542 /// offer such a guarantee. See the last example below and the documentation
543- /// of `try_unwrap`[`Arc::try_unwrap`].
543+ /// of [ `try_unwrap`] [`Arc::try_unwrap`].
544544 ///
545545 /// # Examples
546546 ///
Original file line number Diff line number Diff line change @@ -140,41 +140,6 @@ fn unwrap_or_drop() {
140140 assert_eq ! ( Arc :: unwrap_or_drop( x) , Some ( 5 ) ) ;
141141}
142142
143- #[ test]
144- fn unwrap_or_drop_linked_list ( ) {
145- #[ derive( Clone ) ]
146- struct LinkedList < T > ( Option < Arc < Node < T > > > ) ;
147- struct Node < T > ( T , Option < Arc < Node < T > > > ) ;
148-
149- impl < T > Drop for LinkedList < T > {
150- fn drop ( & mut self ) {
151- let mut x = self . 0 . take ( ) ;
152- while let Some ( arc) = x. take ( ) {
153- Arc :: unwrap_or_drop ( arc) . map ( |node| x = node. 1 ) ;
154- }
155- }
156- }
157-
158- impl < T > LinkedList < T > {
159- fn push ( & mut self , x : T ) {
160- self . 0 = Some ( Arc :: new ( Node ( x, self . 0 . take ( ) ) ) ) ;
161- }
162- }
163-
164- use std:: thread;
165- for _ in 0 ..25 {
166- let mut x = LinkedList ( None ) ;
167- for i in 0 ..100000 {
168- x. push ( i) ;
169- }
170- let y = x. clone ( ) ;
171- let t1 = thread:: spawn ( || drop ( x) ) ;
172- let t2 = thread:: spawn ( || drop ( y) ) ;
173- t1. join ( ) . unwrap ( ) ;
174- t2. join ( ) . unwrap ( ) ;
175- }
176- }
177-
178143#[ test]
179144fn into_from_raw ( ) {
180145 let x = Arc :: new ( box "hello" ) ;
You can’t perform that action at this time.
0 commit comments