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 @@ -524,7 +524,7 @@ impl<T> Arc<T> {
524
524
///
525
525
/// The similar expression `Arc::try_unwrap(this).ok()` does not
526
526
/// offer such a guarantee. See the last example below and the documentation
527
- /// of `try_unwrap`[`Arc::try_unwrap`].
527
+ /// of [ `try_unwrap`] [`Arc::try_unwrap`].
528
528
///
529
529
/// # Examples
530
530
///
Original file line number Diff line number Diff line change @@ -140,41 +140,6 @@ fn unwrap_or_drop() {
140
140
assert_eq ! ( Arc :: unwrap_or_drop( x) , Some ( 5 ) ) ;
141
141
}
142
142
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
-
178
143
#[ test]
179
144
fn into_from_raw ( ) {
180
145
let x = Arc :: new ( box "hello" ) ;
You can’t perform that action at this time.
0 commit comments