Skip to content

Commit d49d927

Browse files
committed
[AVR] Fix debug printing of function pointers
This commit fixes debug printing of function pointers on AVR. AVR does not support `addrspacecast` instructions, and so this patch modifies libcore so that a `ptrtoint` IR instruction is used and the address space cast is avoided.
1 parent a33453a commit d49d927

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libcore/ptr/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2631,14 +2631,14 @@ macro_rules! fnptr_impls_safety_abi {
26312631
#[stable(feature = "fnptr_impls", since = "1.4.0")]
26322632
impl<Ret, $($Arg),*> fmt::Pointer for $FnTy {
26332633
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2634-
fmt::Pointer::fmt(&(*self as *const ()), f)
2634+
fmt::Pointer::fmt(&(*self as usize as *const ()), f)
26352635
}
26362636
}
26372637

26382638
#[stable(feature = "fnptr_impls", since = "1.4.0")]
26392639
impl<Ret, $($Arg),*> fmt::Debug for $FnTy {
26402640
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2641-
fmt::Pointer::fmt(&(*self as *const ()), f)
2641+
fmt::Pointer::fmt(&(*self as usize as *const ()), f)
26422642
}
26432643
}
26442644
}

0 commit comments

Comments
 (0)