Skip to content

Commit 6ab8f3d

Browse files
tell miri to stop fake-inlining test fn
use a few less sus casts for skip_inner_frames and use inline(never) to appease miri. miri now tries to pretend this frame may differ.
1 parent bdf8bba commit 6ab8f3d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tests/skip_inner_frames.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use backtrace::Backtrace;
2+
use core::ffi::c_void;
23

34
// This test only works on platforms which have a working `symbol_address`
45
// function for frames which reports the starting address of a symbol. As a
@@ -12,6 +13,7 @@ const ENABLED: bool = cfg!(all(
1213
));
1314

1415
#[test]
16+
#[inline(never)]
1517
fn backtrace_new_unresolved_should_start_with_call_site_trace() {
1618
if !ENABLED {
1719
return;
@@ -22,13 +24,14 @@ fn backtrace_new_unresolved_should_start_with_call_site_trace() {
2224

2325
assert!(!b.frames().is_empty());
2426

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();
2830
assert_eq!(this_ip, frame_ip);
2931
}
3032

3133
#[test]
34+
#[inline(never)]
3235
fn backtrace_new_should_start_with_call_site_trace() {
3336
if !ENABLED {
3437
return;
@@ -38,7 +41,7 @@ fn backtrace_new_should_start_with_call_site_trace() {
3841

3942
assert!(!b.frames().is_empty());
4043

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();
4346
assert_eq!(this_ip, frame_ip);
4447
}

0 commit comments

Comments
 (0)