@@ -53,7 +53,7 @@ impl Thread {
5353
5454 let stack_size = cmp:: max ( stack, min_stack_size ( & attr) ) ;
5555 match pthread_attr_setstacksize ( & mut attr,
56- stack_size as libc :: size_t ) {
56+ stack_size) {
5757 0 => { }
5858 n => {
5959 assert_eq ! ( n, libc:: EINVAL ) ;
@@ -64,7 +64,6 @@ impl Thread {
6464 let page_size = os:: page_size ( ) ;
6565 let stack_size = ( stack_size + page_size - 1 ) &
6666 ( -( page_size as isize - 1 ) as usize - 1 ) ;
67- let stack_size = stack_size as libc:: size_t ;
6867 assert_eq ! ( libc:: pthread_attr_setstacksize( & mut attr,
6968 stack_size) , 0 ) ;
7069 }
@@ -264,12 +263,8 @@ pub mod guard {
264263 // Rellocate the last page of the stack.
265264 // This ensures SIGBUS will be raised on
266265 // stack overflow.
267- let result = mmap ( stackaddr,
268- psize as libc:: size_t ,
269- PROT_NONE ,
270- MAP_PRIVATE | MAP_ANON | MAP_FIXED ,
271- -1 ,
272- 0 ) ;
266+ let result = mmap ( stackaddr, psize, PROT_NONE ,
267+ MAP_PRIVATE | MAP_ANON | MAP_FIXED , -1 , 0 ) ;
273268
274269 if result != stackaddr || result == MAP_FAILED {
275270 panic ! ( "failed to allocate a guard page" ) ;
@@ -293,8 +288,8 @@ pub mod guard {
293288
294289 #[ cfg( target_os = "macos" ) ]
295290 pub unsafe fn current ( ) -> Option < usize > {
296- Some ( ( libc:: pthread_get_stackaddr_np ( libc:: pthread_self ( ) ) as libc :: size_t -
297- libc:: pthread_get_stacksize_np ( libc:: pthread_self ( ) ) ) as usize )
291+ Some ( ( libc:: pthread_get_stackaddr_np ( libc:: pthread_self ( ) ) as usize -
292+ libc:: pthread_get_stacksize_np ( libc:: pthread_self ( ) ) ) )
298293 }
299294
300295 #[ cfg( any( target_os = "openbsd" , target_os = "bitrig" ) ) ]
@@ -306,10 +301,10 @@ pub mod guard {
306301 let extra = if cfg ! ( target_os = "bitrig" ) { 3 } else { 1 } * os:: page_size ( ) ;
307302 Some ( if libc:: pthread_main_np ( ) == 1 {
308303 // main thread
309- current_stack. ss_sp as usize - current_stack. ss_size as usize + extra
304+ current_stack. ss_sp as usize - current_stack. ss_size + extra
310305 } else {
311306 // new thread
312- current_stack. ss_sp as usize - current_stack. ss_size as usize
307+ current_stack. ss_sp as usize - current_stack. ss_size
313308 } )
314309 }
315310
@@ -335,11 +330,11 @@ pub mod guard {
335330 & mut size) , 0 ) ;
336331
337332 ret = if cfg ! ( target_os = "freebsd" ) {
338- Some ( stackaddr as usize - guardsize as usize )
333+ Some ( stackaddr as usize - guardsize)
339334 } else if cfg ! ( target_os = "netbsd" ) {
340335 Some ( stackaddr as usize )
341336 } else {
342- Some ( stackaddr as usize + guardsize as usize )
337+ Some ( stackaddr as usize + guardsize)
343338 } ;
344339 }
345340 assert_eq ! ( libc:: pthread_attr_destroy( & mut attr) , 0 ) ;
@@ -358,8 +353,8 @@ fn min_stack_size(attr: *const libc::pthread_attr_t) -> usize {
358353 weak ! ( fn __pthread_get_minstack( * const libc:: pthread_attr_t) -> libc:: size_t) ;
359354
360355 match __pthread_get_minstack. get ( ) {
361- None => libc:: PTHREAD_STACK_MIN as usize ,
362- Some ( f) => unsafe { f ( attr) as usize } ,
356+ None => libc:: PTHREAD_STACK_MIN ,
357+ Some ( f) => unsafe { f ( attr) } ,
363358 }
364359}
365360
@@ -368,7 +363,7 @@ fn min_stack_size(attr: *const libc::pthread_attr_t) -> usize {
368363#[ cfg( all( not( target_os = "linux" ) ,
369364 not( target_os = "netbsd" ) ) ) ]
370365fn min_stack_size ( _: * const libc:: pthread_attr_t ) -> usize {
371- libc:: PTHREAD_STACK_MIN as usize
366+ libc:: PTHREAD_STACK_MIN
372367}
373368
374369#[ cfg( target_os = "netbsd" ) ]
0 commit comments