Skip to content

Commit 8b031b9

Browse files
committed
?Sized support for VirtAddr::from_ptr
1 parent 135d18a commit 8b031b9

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/addr.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,8 @@ impl VirtAddr {
129129
// doesn't truncate.
130130
#[cfg(any(target_pointer_width = "32", target_pointer_width = "64"))]
131131
#[inline]
132-
pub fn from_ptr<T>(ptr: *const T) -> Self {
133-
Self::new(ptr as u64)
134-
}
135-
136-
/// Creates a virtual address from the given slice.
137-
#[cfg(target_pointer_width = "64")]
138-
pub fn from_slice<T>(slice: &[T]) -> Self {
139-
Self::new(slice as *const [T] as *const T as u64)
132+
pub fn from_ptr<T: ?Sized>(ptr: *const T) -> Self {
133+
Self::new(ptr as *const () as u64)
140134
}
141135

142136
/// Converts the address to a raw pointer.

0 commit comments

Comments
 (0)