Keep the unsafe helper change minimal

This commit is contained in:
iris committed 2026-09-13 01:04:10 -04:00
1 parent a1ff76776c
commit 472736a292
2 files changed
+4 -15

No files matched your search

+1 -1
View File
@@ -16,7 +16,7 @@ pub use id::*;
pub use math::*;
pub use refcount::*;
pub use slot::*;
pub use trust::*;
pub(crate) use trust::*;
pub use typemap::*;
pub use vec2::*;
+3 -14
View File
@@ -1,25 +1,14 @@
/// Extends a shared reference's lifetime.
///
/// # Safety
/// The pointee must remain alive and shared-borrowed for all of `'a`.
#[allow(clippy::missing_safety_doc)]
pub(crate) unsafe fn forget_ref<'a, T>(x: &T) -> &'a T {
unsafe { std::mem::transmute::<&T, &T>(x) }
}
/// Extends an exclusive reference's lifetime.
///
/// # Safety
/// The pointee must remain alive and exclusively borrowed for all of `'a`.
#[allow(clippy::missing_safety_doc)]
pub(crate) unsafe fn forget_mut<'a, T>(x: &mut T) -> &'a mut T {
unsafe { std::mem::transmute::<&mut T, &mut T>(x) }
}
/// Converts a shared reference into an exclusive reference.
///
/// # Safety
/// The caller must have exclusive access to the pointee for the returned
/// reference's lifetime.
#[allow(clippy::mut_from_ref)]
#[allow(clippy::mut_from_ref, clippy::missing_safety_doc)]
pub(crate) unsafe fn to_mut<T>(x: &T) -> &mut T {
#[allow(mutable_transmutes)]
unsafe {