@@ -498,12 +498,12 @@ impl Builder {
498
498
// exist after the thread has terminated, which is signaled by `Thread::join`
499
499
// returning.
500
500
native : unsafe {
501
- Some ( imp:: Thread :: new (
501
+ imp:: Thread :: new (
502
502
stack_size,
503
503
mem:: transmute :: < Box < dyn FnOnce ( ) + ' a > , Box < dyn FnOnce ( ) + ' static > > (
504
504
Box :: new ( main) ,
505
505
) ,
506
- ) ?)
506
+ ) ?
507
507
} ,
508
508
thread : my_thread,
509
509
packet : Packet ( my_packet) ,
@@ -1258,15 +1258,15 @@ unsafe impl<T: Sync> Sync for Packet<T> {}
1258
1258
1259
1259
/// Inner representation for JoinHandle
1260
1260
struct JoinInner < T > {
1261
- native : Option < imp:: Thread > ,
1261
+ native : imp:: Thread ,
1262
1262
thread : Thread ,
1263
1263
packet : Packet < T > ,
1264
1264
}
1265
1265
1266
1266
impl < T > JoinInner < T > {
1267
- fn join ( & mut self ) -> Result < T > {
1268
- self . native . take ( ) . unwrap ( ) . join ( ) ;
1269
- unsafe { ( * self . packet . 0 . get ( ) ) . take ( ) . unwrap ( ) }
1267
+ fn join ( mut self ) -> Result < T > {
1268
+ self . native . join ( ) ;
1269
+ Arc :: get_mut ( & mut self . packet . 0 ) . unwrap ( ) . get_mut ( ) . take ( ) . unwrap ( )
1270
1270
}
1271
1271
}
1272
1272
@@ -1397,7 +1397,7 @@ impl<T> JoinHandle<T> {
1397
1397
/// join_handle.join().expect("Couldn't join on the associated thread");
1398
1398
/// ```
1399
1399
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1400
- pub fn join ( mut self ) -> Result < T > {
1400
+ pub fn join ( self ) -> Result < T > {
1401
1401
self . 0 . join ( )
1402
1402
}
1403
1403
@@ -1413,13 +1413,13 @@ impl<T> JoinHandle<T> {
1413
1413
1414
1414
impl < T > AsInner < imp:: Thread > for JoinHandle < T > {
1415
1415
fn as_inner ( & self ) -> & imp:: Thread {
1416
- self . 0 . native . as_ref ( ) . unwrap ( )
1416
+ & self . 0 . native
1417
1417
}
1418
1418
}
1419
1419
1420
1420
impl < T > IntoInner < imp:: Thread > for JoinHandle < T > {
1421
1421
fn into_inner ( self ) -> imp:: Thread {
1422
- self . 0 . native . unwrap ( )
1422
+ self . 0 . native
1423
1423
}
1424
1424
}
1425
1425
0 commit comments