Skip to content

Commit 44240ac

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 84edb81 commit 44240ac

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
@@ -2836,14 +2836,14 @@ macro_rules! fnptr_impls_safety_abi {
28362836
#[stable(feature = "fnptr_impls", since = "1.4.0")]
28372837
impl<Ret, $($Arg),*> fmt::Pointer for $FnTy {
28382838
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2839-
fmt::Pointer::fmt(&(*self as *const ()), f)
2839+
fmt::Pointer::fmt(&(*self as usize as *const ()), f)
28402840
}
28412841
}
28422842

28432843
#[stable(feature = "fnptr_impls", since = "1.4.0")]
28442844
impl<Ret, $($Arg),*> fmt::Debug for $FnTy {
28452845
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2846-
fmt::Pointer::fmt(&(*self as *const ()), f)
2846+
fmt::Pointer::fmt(&(*self as usize as *const ()), f)
28472847
}
28482848
}
28492849
}

0 commit comments

Comments
 (0)