From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- .../pin-project/tests/include/basic-safe-part.rs | 193 +++++++++++++++++++++ .../rust/pin-project/tests/include/basic.rs | 17 ++ 2 files changed, 210 insertions(+) create mode 100644 third_party/rust/pin-project/tests/include/basic-safe-part.rs create mode 100644 third_party/rust/pin-project/tests/include/basic.rs (limited to 'third_party/rust/pin-project/tests/include') diff --git a/third_party/rust/pin-project/tests/include/basic-safe-part.rs b/third_party/rust/pin-project/tests/include/basic-safe-part.rs new file mode 100644 index 0000000000..0b7c43e873 --- /dev/null +++ b/third_party/rust/pin-project/tests/include/basic-safe-part.rs @@ -0,0 +1,193 @@ +// default #[pin_project], PinnedDrop, project_replace, !Unpin, and UnsafeUnpin without UnsafeUnpin impl are completely safe. + +#[::pin_project::pin_project] +#[derive(Debug)] +pub struct DefaultStruct { + #[pin] + pub pinned: T, + pub unpinned: U, +} + +#[::pin_project::pin_project( + project = DefaultStructNamedProj, + project_ref = DefaultStructNamedProjRef, +)] +#[derive(Debug)] +pub struct DefaultStructNamed { + #[pin] + pub pinned: T, + pub unpinned: U, +} + +#[::pin_project::pin_project] +#[derive(Debug)] +pub struct DefaultTupleStruct(#[pin] pub T, pub U); + +#[::pin_project::pin_project( + project = DefaultTupleStructNamedProj, + project_ref = DefaultTupleStructNamedProjRef, +)] +#[derive(Debug)] +pub struct DefaultTupleStructNamed(#[pin] pub T, pub U); + +#[::pin_project::pin_project( + project = DefaultEnumProj, + project_ref = DefaultEnumProjRef, +)] +#[derive(Debug)] +pub enum DefaultEnum { + Struct { + #[pin] + pinned: T, + unpinned: U, + }, + Tuple(#[pin] T, U), + Unit, +} + +#[::pin_project::pin_project(PinnedDrop)] +#[derive(Debug)] +pub struct PinnedDropStruct { + #[pin] + pub pinned: T, + pub unpinned: U, +} + +#[::pin_project::pinned_drop] +impl PinnedDrop for PinnedDropStruct { + fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} +} + +#[::pin_project::pin_project(PinnedDrop)] +#[derive(Debug)] +pub struct PinnedDropTupleStruct(#[pin] pub T, pub U); + +#[::pin_project::pinned_drop] +impl PinnedDrop for PinnedDropTupleStruct { + fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} +} + +#[::pin_project::pin_project( + PinnedDrop, + project = PinnedDropEnumProj, + project_ref = PinnedDropEnumProjRef, +)] +#[derive(Debug)] +pub enum PinnedDropEnum { + Struct { + #[pin] + pinned: T, + unpinned: U, + }, + Tuple(#[pin] T, U), + Unit, +} + +#[::pin_project::pinned_drop] +impl PinnedDrop for PinnedDropEnum { + fn drop(self: ::pin_project::__private::Pin<&mut Self>) {} +} + +#[::pin_project::pin_project(project_replace)] +#[derive(Debug)] +pub struct ReplaceStruct { + #[pin] + pub pinned: T, + pub unpinned: U, +} + +#[::pin_project::pin_project( + project = ReplaceStructNamedProj, + project_ref = ReplaceStructNamedProjRef, + project_replace = ReplaceStructNamedProjOwn, +)] +#[derive(Debug)] +pub struct ReplaceStructNamed { + #[pin] + pub pinned: T, + pub unpinned: U, +} + +#[::pin_project::pin_project(project_replace)] +#[derive(Debug)] +pub struct ReplaceTupleStruct(#[pin] pub T, pub U); + +#[::pin_project::pin_project( + project = ReplaceTupleStructNamedProj, + project_ref = ReplaceTupleStructNamedProjRef, + project_replace = ReplaceTupleStructNamedProjOwn, +)] +#[derive(Debug)] +pub struct ReplaceTupleStructNamed(#[pin] pub T, pub U); + +#[::pin_project::pin_project( + project = ReplaceEnumProj, + project_ref = ReplaceEnumProjRef, + project_replace = ReplaceEnumProjOwn, +)] +#[derive(Debug)] +pub enum ReplaceEnum { + Struct { + #[pin] + pinned: T, + unpinned: U, + }, + Tuple(#[pin] T, U), + Unit, +} + +#[::pin_project::pin_project(UnsafeUnpin)] +#[derive(Debug)] +pub struct UnsafeUnpinStruct { + #[pin] + pub pinned: T, + pub unpinned: U, +} + +#[::pin_project::pin_project(UnsafeUnpin)] +#[derive(Debug)] +pub struct UnsafeUnpinTupleStruct(#[pin] pub T, pub U); + +#[::pin_project::pin_project( + UnsafeUnpin, + project = UnsafeUnpinEnumProj, + project_ref = UnsafeUnpinEnumProjRef, +)] +#[derive(Debug)] +pub enum UnsafeUnpinEnum { + Struct { + #[pin] + pinned: T, + unpinned: U, + }, + Tuple(#[pin] T, U), + Unit, +} + +#[::pin_project::pin_project(!Unpin)] +#[derive(Debug)] +pub struct NotUnpinStruct { + #[pin] + pub pinned: T, + pub unpinned: U, +} + +#[::pin_project::pin_project(!Unpin)] +#[derive(Debug)] +pub struct NotUnpinTupleStruct(#[pin] pub T, pub U); + +#[::pin_project::pin_project( + !Unpin, + project = NotUnpinEnumProj, + project_ref = NotUnpinEnumProjRef, +)] +#[derive(Debug)] +pub enum NotUnpinEnum { + Struct { + #[pin] + pinned: T, + unpinned: U, + }, + Tuple(#[pin] T, U), + Unit, +} diff --git a/third_party/rust/pin-project/tests/include/basic.rs b/third_party/rust/pin-project/tests/include/basic.rs new file mode 100644 index 0000000000..57cbaeb86b --- /dev/null +++ b/third_party/rust/pin-project/tests/include/basic.rs @@ -0,0 +1,17 @@ +include!("basic-safe-part.rs"); + +#[allow(clippy::undocumented_unsafe_blocks)] +unsafe impl + ::pin_project::UnsafeUnpin for UnsafeUnpinStruct +{ +} +#[allow(clippy::undocumented_unsafe_blocks)] +unsafe impl + ::pin_project::UnsafeUnpin for UnsafeUnpinTupleStruct +{ +} +#[allow(clippy::undocumented_unsafe_blocks)] +unsafe impl + ::pin_project::UnsafeUnpin for UnsafeUnpinEnum +{ +} -- cgit v1.2.3