summaryrefslogtreecommitdiffstats
path: root/vendor/zerovec/src/yoke_impls.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /vendor/zerovec/src/yoke_impls.rs
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/zerovec/src/yoke_impls.rs')
-rw-r--r--vendor/zerovec/src/yoke_impls.rs47
1 files changed, 25 insertions, 22 deletions
diff --git a/vendor/zerovec/src/yoke_impls.rs b/vendor/zerovec/src/yoke_impls.rs
index a5064a554..8b196cf9a 100644
--- a/vendor/zerovec/src/yoke_impls.rs
+++ b/vendor/zerovec/src/yoke_impls.rs
@@ -3,6 +3,9 @@
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
// This way we can copy-paste Yokeable impls
+#![allow(unknown_lints)] // forgetting_copy_types
+#![allow(renamed_and_removed_lints)] // forgetting_copy_types
+#![allow(forgetting_copy_types)]
#![allow(clippy::forget_copy)]
#![allow(clippy::forget_non_drop)]
@@ -30,8 +33,8 @@ unsafe impl<'a, T: 'static + AsULE + ?Sized> Yokeable<'a> for ZeroVec<'static, T
#[inline]
unsafe fn make(from: Self::Output) -> Self {
debug_assert!(mem::size_of::<Self::Output>() == mem::size_of::<Self>());
- let ptr: *const Self = (&from as *const Self::Output).cast();
- mem::forget(from);
+ let from = mem::ManuallyDrop::new(from);
+ let ptr: *const Self = (&*from as *const Self::Output).cast();
ptr::read(ptr)
}
#[inline]
@@ -58,8 +61,8 @@ unsafe impl<'a, T: 'static + VarULE + ?Sized> Yokeable<'a> for VarZeroVec<'stati
#[inline]
unsafe fn make(from: Self::Output) -> Self {
debug_assert!(mem::size_of::<Self::Output>() == mem::size_of::<Self>());
- let ptr: *const Self = (&from as *const Self::Output).cast();
- mem::forget(from);
+ let from = mem::ManuallyDrop::new(from);
+ let ptr: *const Self = (&*from as *const Self::Output).cast();
ptr::read(ptr)
}
#[inline]
@@ -86,8 +89,8 @@ unsafe impl<'a> Yokeable<'a> for FlexZeroVec<'static> {
#[inline]
unsafe fn make(from: Self::Output) -> Self {
debug_assert!(mem::size_of::<Self::Output>() == mem::size_of::<Self>());
- let ptr: *const Self = (&from as *const Self::Output).cast();
- mem::forget(from);
+ let from = mem::ManuallyDrop::new(from);
+ let ptr: *const Self = (&*from as *const Self::Output).cast();
ptr::read(ptr)
}
#[inline]
@@ -124,16 +127,16 @@ where
unsafe {
// Similar problem as transform(), but we need to use ptr::read since
// the compiler isn't sure of the sizes
- let ptr: *const Self::Output = (&self as *const Self).cast();
- mem::forget(self);
+ let this = mem::ManuallyDrop::new(self);
+ let ptr: *const Self::Output = (&*this as *const Self).cast();
ptr::read(ptr)
}
}
#[inline]
unsafe fn make(from: Self::Output) -> Self {
debug_assert!(mem::size_of::<Self::Output>() == mem::size_of::<Self>());
- let ptr: *const Self = (&from as *const Self::Output).cast();
- mem::forget(from);
+ let from = mem::ManuallyDrop::new(from);
+ let ptr: *const Self = (&*from as *const Self::Output).cast();
ptr::read(ptr)
}
#[inline]
@@ -170,16 +173,16 @@ where
unsafe {
// Similar problem as transform(), but we need to use ptr::read since
// the compiler isn't sure of the sizes
- let ptr: *const Self::Output = (&self as *const Self).cast();
- mem::forget(self);
+ let this = mem::ManuallyDrop::new(self);
+ let ptr: *const Self::Output = (&*this as *const Self).cast();
ptr::read(ptr)
}
}
#[inline]
unsafe fn make(from: Self::Output) -> Self {
debug_assert!(mem::size_of::<Self::Output>() == mem::size_of::<Self>());
- let ptr: *const Self = (&from as *const Self::Output).cast();
- mem::forget(from);
+ let from = mem::ManuallyDrop::new(from);
+ let ptr: *const Self = (&*from as *const Self::Output).cast();
ptr::read(ptr)
}
#[inline]
@@ -218,16 +221,16 @@ where
unsafe {
// Similar problem as transform(), but we need to use ptr::read since
// the compiler isn't sure of the sizes
- let ptr: *const Self::Output = (&self as *const Self).cast();
- mem::forget(self);
+ let this = mem::ManuallyDrop::new(self);
+ let ptr: *const Self::Output = (&*this as *const Self).cast();
ptr::read(ptr)
}
}
#[inline]
unsafe fn make(from: Self::Output) -> Self {
debug_assert!(mem::size_of::<Self::Output>() == mem::size_of::<Self>());
- let ptr: *const Self = (&from as *const Self::Output).cast();
- mem::forget(from);
+ let from = mem::ManuallyDrop::new(from);
+ let ptr: *const Self = (&*from as *const Self::Output).cast();
ptr::read(ptr)
}
#[inline]
@@ -266,16 +269,16 @@ where
unsafe {
// Similar problem as transform(), but we need to use ptr::read since
// the compiler isn't sure of the sizes
- let ptr: *const Self::Output = (&self as *const Self).cast();
- mem::forget(self);
+ let this = mem::ManuallyDrop::new(self);
+ let ptr: *const Self::Output = (&*this as *const Self).cast();
ptr::read(ptr)
}
}
#[inline]
unsafe fn make(from: Self::Output) -> Self {
debug_assert!(mem::size_of::<Self::Output>() == mem::size_of::<Self>());
- let ptr: *const Self = (&from as *const Self::Output).cast();
- mem::forget(from);
+ let from = mem::ManuallyDrop::new(from);
+ let ptr: *const Self = (&*from as *const Self::Output).cast();
ptr::read(ptr)
}
#[inline]