11use backtrace:: Frame ;
2+ use core:: ffi:: c_void;
23use std:: ptr;
34use std:: thread;
45
@@ -249,11 +250,11 @@ fn sp_smoke_test() {
249250 return ;
250251
251252 #[ inline( never) ]
252- fn recursive_stack_references ( refs : & mut Vec < usize > ) {
253+ fn recursive_stack_references ( refs : & mut Vec < * mut c_void > ) {
253254 assert ! ( refs. len( ) < 5 ) ;
254255
255- let x = refs. len ( ) ;
256- refs. push ( ptr:: addr_of !( x) as usize ) ;
256+ let mut x = refs. len ( ) ;
257+ refs. push ( ptr:: addr_of_mut !( x) . cast ( ) ) ;
257258
258259 if refs. len ( ) < 5 {
259260 recursive_stack_references ( refs) ;
@@ -271,7 +272,7 @@ fn sp_smoke_test() {
271272 // mangled names.
272273
273274 fn make_trace_closure < ' a > (
274- refs : & ' a mut Vec < usize > ,
275+ refs : & ' a mut Vec < * mut c_void > ,
275276 ) -> impl FnMut ( & backtrace:: Frame ) -> bool + ' a {
276277 let mut child_sp = None ;
277278 let mut child_ref = None ;
@@ -289,9 +290,9 @@ fn sp_smoke_test() {
289290 } )
290291 } ) ;
291292
292- let sp = frame. sp ( ) as usize ;
293- eprintln ! ( "sp = {:p}" , sp as * const u8 ) ;
294- if sp == 0 {
293+ let sp = frame. sp ( ) ;
294+ eprintln ! ( "sp = {sp :p}" ) ;
295+ if sp as usize == 0 {
295296 // If the SP is null, then we don't have an implementation for
296297 // getting the SP on this target. Just keep walking the stack,
297298 // but don't make our assertions about the on-stack pointers and
@@ -306,8 +307,8 @@ fn sp_smoke_test() {
306307
307308 if is_recursive_stack_references {
308309 let r = refs. pop ( ) . unwrap ( ) ;
309- eprintln ! ( "ref = {:p}" , r as * const u8 ) ;
310- if sp != 0 {
310+ eprintln ! ( "ref = {:p}" , r) ;
311+ if sp as usize != 0 {
311312 assert ! ( r > sp) ;
312313 if let Some ( child_ref) = child_ref {
313314 assert ! ( sp >= child_ref) ;
0 commit comments