mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-23 15:24:25 +00:00
Fix UB in AllocationHandle::as_index
(#2596)
This commit is contained in:
parent
a1307b6ef8
commit
9c0082e048
@ -150,7 +150,7 @@ impl AllocationHandle {
|
||||
/// [`from_index`]: Self::from_index
|
||||
#[allow(clippy::transmutes_expressible_as_ptr_casts)]
|
||||
#[inline]
|
||||
pub const fn as_index(self) -> usize {
|
||||
pub fn as_index(self) -> usize {
|
||||
// SAFETY: `usize` and `*mut ()` have the same layout.
|
||||
unsafe { mem::transmute::<*mut (), usize>(self.0) }
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ impl AllocationHandle {
|
||||
/// [`from_index`]: Self::from_index
|
||||
#[allow(clippy::transmutes_expressible_as_ptr_casts)]
|
||||
#[inline]
|
||||
pub const fn as_index(self) -> usize {
|
||||
pub fn as_index(self) -> usize {
|
||||
// SAFETY: `usize` and `*mut ()` have the same layout.
|
||||
unsafe { mem::transmute::<*mut (), usize>(self.0) }
|
||||
}
|
||||
|
@ -777,7 +777,7 @@ impl AllocationHandle {
|
||||
/// [`from_index`]: Self::from_index
|
||||
#[allow(clippy::transmutes_expressible_as_ptr_casts)]
|
||||
#[inline]
|
||||
pub const fn as_index(self) -> usize {
|
||||
pub fn as_index(self) -> usize {
|
||||
// SAFETY: `usize` and `*mut ()` have the same layout.
|
||||
unsafe { mem::transmute::<*mut (), usize>(self.0) }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user