Skip to content

Commit

Permalink
Allow pointer transmutes
Browse files Browse the repository at this point in the history
  • Loading branch information
JustusAdam committed Nov 22, 2023
1 parent 0b6ba1e commit 9362624
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions library/kani/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,16 @@ impl<'a, 'b, T> Pointer<'a> for &'b T {
std::mem::transmute(self)
}

#[allow(clippy::transmute_ptr_to_ref)]
unsafe fn assignable(self) -> &'a mut Self::Inner {
std::mem::transmute(self as *const T)
}
}

impl<'a, 'b, T> Pointer<'a> for &'b mut T {
type Inner = T;

#[allow(clippy::transmute_ptr_to_ref)]
unsafe fn decouple_lifetime(self) -> &'a Self::Inner {
std::mem::transmute(self as *mut T)
}
Expand All @@ -127,6 +130,7 @@ impl<'a, T> Pointer<'a> for *const T {
&*self as &'a T
}

#[allow(clippy::transmute_ptr_to_ref)]
unsafe fn assignable(self) -> &'a mut Self::Inner {
std::mem::transmute(self)
}
Expand All @@ -138,6 +142,7 @@ impl<'a, T> Pointer<'a> for *mut T {
&*self as &'a T
}

#[allow(clippy::transmute_ptr_to_ref)]
unsafe fn assignable(self) -> &'a mut Self::Inner {
std::mem::transmute(self)
}
Expand Down

0 comments on commit 9362624

Please sign in to comment.