From 1d56ec56b54feb5b5117adb8f6e10c2e1381a5f9 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Sat, 27 Jul 2024 15:30:34 -0700 Subject: [PATCH] fix test properly --- tests/smoke.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/smoke.rs b/tests/smoke.rs index 4539642c..975f4c28 100644 --- a/tests/smoke.rs +++ b/tests/smoke.rs @@ -1,4 +1,5 @@ use backtrace::Frame; +use core::ffi::c_void; use std::ptr; use std::thread; @@ -249,11 +250,11 @@ fn sp_smoke_test() { return; #[inline(never)] - fn recursive_stack_references(refs: &mut Vec) { + fn recursive_stack_references(refs: &mut Vec<*mut c_void>) { assert!(refs.len() < 5); - let x = refs.len(); - refs.push(ptr::addr_of!(x) as usize); + let mut x = refs.len(); + refs.push(ptr::addr_of_mut!(x).cast()); if refs.len() < 5 { recursive_stack_references(refs); @@ -271,7 +272,7 @@ fn sp_smoke_test() { // mangled names. fn make_trace_closure<'a>( - refs: &'a mut Vec, + refs: &'a mut Vec<*mut c_void>, ) -> impl FnMut(&backtrace::Frame) -> bool + 'a { let mut child_sp = None; let mut child_ref = None; @@ -306,8 +307,8 @@ fn sp_smoke_test() { if is_recursive_stack_references { let r = refs.pop().unwrap(); - eprintln!("ref = {:p}", r as *const u8); - if sp != 0 { + eprintln!("ref = {:p}", r); + if sp as usize != 0 { assert!(r > sp); if let Some(child_ref) = child_ref { assert!(sp >= child_ref);