Skip to content

Commit 22917f8

Browse files
committed
Add missing #[cfg(target_pointer_width)].
1 parent 1c358b1 commit 22917f8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/addr.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ impl VirtAddr {
8888
}
8989

9090
/// Creates a virtual address from the given pointer
91+
// cfg(target_pointer_width = "32") is only here for backwards
92+
// compatibility: Earlier versions of this crate did not have any `cfg()`
93+
// on this function. At least for 32- and 64-bit we know the `as u64` cast
94+
// doesn't truncate.
95+
#[cfg(any(target_pointer_width = "32", target_pointer_width = "64"))]
9196
pub fn from_ptr<T>(ptr: *const T) -> Self {
9297
Self::new(ptr as u64)
9398
}

0 commit comments

Comments
 (0)