Skip to content

Commit

Permalink
Pull back MSRV-breaking ptr::from_ref
Browse files Browse the repository at this point in the history
  • Loading branch information
workingjubilee committed Mar 22, 2024
1 parent ddf1b89 commit 3f08ec0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/symbolize/dbghelp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ use core::mem;
use core::ptr;
use core::slice;

// FIXME: replace with ptr::from_ref once MSRV is high enough
#[inline(always)]
#[must_use]
const fn ptr_from_ref<T: ?Sized>(r: &T) -> *const T {
r
}

// Store an OsString on std so we can provide the symbol name and filename.
pub struct Symbol<'a> {
name: *const [u8],
Expand Down Expand Up @@ -257,7 +264,7 @@ unsafe fn do_resolve(

let len = len as usize;

filename = Some(ptr::from_ref(slice::from_raw_parts(base, len)));
filename = Some(ptr_from_ref(slice::from_raw_parts(base, len)));
}

cb(&super::Symbol {
Expand Down

0 comments on commit 3f08ec0

Please sign in to comment.