1
1
use backtrace:: Backtrace ;
2
+ use core:: ffi:: c_void;
2
3
3
4
// This test only works on platforms which have a working `symbol_address`
4
5
// function for frames which reports the starting address of a symbol. As a
@@ -12,6 +13,7 @@ const ENABLED: bool = cfg!(all(
12
13
) ) ;
13
14
14
15
#[ test]
16
+ #[ inline( never) ]
15
17
fn backtrace_new_unresolved_should_start_with_call_site_trace ( ) {
16
18
if !ENABLED {
17
19
return ;
@@ -22,13 +24,14 @@ fn backtrace_new_unresolved_should_start_with_call_site_trace() {
22
24
23
25
assert ! ( !b. frames( ) . is_empty( ) ) ;
24
26
25
- let this_ip = backtrace_new_unresolved_should_start_with_call_site_trace as usize ;
26
- println ! ( "this_ip: {:? }" , this_ip as * const usize ) ;
27
- let frame_ip = b. frames ( ) . first ( ) . unwrap ( ) . symbol_address ( ) as usize ;
27
+ let this_ip = backtrace_new_unresolved_should_start_with_call_site_trace as * mut c_void ;
28
+ println ! ( "this_ip: {:p }" , this_ip) ;
29
+ let frame_ip = b. frames ( ) . first ( ) . unwrap ( ) . symbol_address ( ) ;
28
30
assert_eq ! ( this_ip, frame_ip) ;
29
31
}
30
32
31
33
#[ test]
34
+ #[ inline( never) ]
32
35
fn backtrace_new_should_start_with_call_site_trace ( ) {
33
36
if !ENABLED {
34
37
return ;
@@ -38,7 +41,7 @@ fn backtrace_new_should_start_with_call_site_trace() {
38
41
39
42
assert ! ( !b. frames( ) . is_empty( ) ) ;
40
43
41
- let this_ip = backtrace_new_should_start_with_call_site_trace as usize ;
42
- let frame_ip = b. frames ( ) . first ( ) . unwrap ( ) . symbol_address ( ) as usize ;
44
+ let this_ip = backtrace_new_should_start_with_call_site_trace as * mut c_void ;
45
+ let frame_ip = b. frames ( ) . first ( ) . unwrap ( ) . symbol_address ( ) ;
43
46
assert_eq ! ( this_ip, frame_ip) ;
44
47
}
0 commit comments