Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/test-utils/src/minicore.rs')
| -rw-r--r-- | crates/test-utils/src/minicore.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/crates/test-utils/src/minicore.rs b/crates/test-utils/src/minicore.rs index 2f0c086092..ca1dbf532c 100644 --- a/crates/test-utils/src/minicore.rs +++ b/crates/test-utils/src/minicore.rs @@ -31,6 +31,7 @@ //! infallible: //! iterator: option //! iterators: iterator, fn +//! manually_drop: drop //! non_zero: //! option: panic //! ord: eq, option @@ -194,6 +195,30 @@ pub mod convert { // region:drop pub mod mem { + // region:manually_drop + #[lang = "manually_drop"] + #[repr(transparent)] + pub struct ManuallyDrop<T: ?Sized> { + value: T, + } + + impl<T> ManuallyDrop<T> { + pub const fn new(value: T) -> ManuallyDrop<T> { + ManuallyDrop { value } + } + } + + // region:deref + impl<T: ?Sized> crate::ops::Deref for ManuallyDrop<T> { + type Target = T; + fn deref(&self) -> &T { + &self.value + } + } + // endregion:deref + + // endregion:manually_drop + pub fn drop<T>(_x: T) {} } // endregion:drop |