diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /third_party/rust/pin-project/tests/expand/naming | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/pin-project/tests/expand/naming')
30 files changed, 1956 insertions, 0 deletions
diff --git a/third_party/rust/pin-project/tests/expand/naming/enum-all.expanded.rs b/third_party/rust/pin-project/tests/expand/naming/enum-all.expanded.rs new file mode 100644 index 0000000000..8dbe768ef3 --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/enum-all.expanded.rs @@ -0,0 +1,204 @@ +use pin_project::pin_project; +#[pin(__private(project = Proj, project_ref = ProjRef, project_replace = ProjOwn))] +enum Enum<T, U> { + Struct { #[pin] pinned: T, unpinned: U }, + Tuple(#[pin] T, U), + Unit, +} +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(dead_code)] +#[allow(clippy::mut_mut)] +enum Proj<'pin, T, U> +where + Enum<T, U>: 'pin, +{ + Struct { + pinned: ::pin_project::__private::Pin<&'pin mut (T)>, + unpinned: &'pin mut (U), + }, + Tuple(::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U)), + Unit, +} +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(dead_code)] +#[allow(clippy::ref_option_ref)] +enum ProjRef<'pin, T, U> +where + Enum<T, U>: 'pin, +{ + Struct { pinned: ::pin_project::__private::Pin<&'pin (T)>, unpinned: &'pin (U) }, + Tuple(::pin_project::__private::Pin<&'pin (T)>, &'pin (U)), + Unit, +} +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(dead_code)] +#[allow(variant_size_differences)] +#[allow(clippy::large_enum_variant)] +enum ProjOwn<T, U> { + Struct { pinned: ::pin_project::__private::PhantomData<T>, unpinned: U }, + Tuple(::pin_project::__private::PhantomData<T>, U), + Unit, +} +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] +#[allow(clippy::semicolon_if_nothing_returned)] +#[allow(clippy::use_self)] +#[allow(clippy::used_underscore_binding)] +const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; + impl<T, U> Enum<T, U> { + #[allow(dead_code)] + fn project<'pin>( + self: _pin_project::__private::Pin<&'pin mut Self>, + ) -> Proj<'pin, T, U> { + unsafe { + match self.get_unchecked_mut() { + Self::Struct { pinned, unpinned } => { + Proj::Struct { + pinned: _pin_project::__private::Pin::new_unchecked(pinned), + unpinned, + } + } + Self::Tuple(_0, _1) => { + Proj::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) + } + Self::Unit => Proj::Unit, + } + } + } + #[allow(dead_code)] + #[allow(clippy::missing_const_for_fn)] + fn project_ref<'pin>( + self: _pin_project::__private::Pin<&'pin Self>, + ) -> ProjRef<'pin, T, U> { + unsafe { + match self.get_ref() { + Self::Struct { pinned, unpinned } => { + ProjRef::Struct { + pinned: _pin_project::__private::Pin::new_unchecked(pinned), + unpinned, + } + } + Self::Tuple(_0, _1) => { + ProjRef::Tuple( + _pin_project::__private::Pin::new_unchecked(_0), + _1, + ) + } + Self::Unit => ProjRef::Unit, + } + } + } + #[allow(dead_code)] + fn project_replace( + self: _pin_project::__private::Pin<&mut Self>, + __replacement: Self, + ) -> ProjOwn<T, U> { + unsafe { + let __self_ptr: *mut Self = self.get_unchecked_mut(); + let __guard = _pin_project::__private::UnsafeOverwriteGuard::new( + __self_ptr, + __replacement, + ); + match &mut *__self_ptr { + Self::Struct { pinned, unpinned } => { + let __result = ProjOwn::Struct { + pinned: _pin_project::__private::PhantomData, + unpinned: _pin_project::__private::ptr::read(unpinned), + }; + { + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new( + pinned, + ); + } + __result + } + Self::Tuple(_0, _1) => { + let __result = ProjOwn::Tuple( + _pin_project::__private::PhantomData, + _pin_project::__private::ptr::read(_1), + ); + { + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new( + _0, + ); + } + __result + } + Self::Unit => { + let __result = ProjOwn::Unit; + {} + __result + } + } + } + } + } + #[allow(missing_debug_implementations)] + struct __Enum<'pin, T, U> { + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + 'pin, + ( + _pin_project::__private::PhantomData<T>, + _pin_project::__private::PhantomData<U>, + ), + >, + __field0: T, + __field1: T, + } + impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U> + where + __Enum<'pin, T, U>: _pin_project::__private::Unpin, + {} + #[doc(hidden)] + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum<T, U> + where + __Enum<'pin, T, U>: _pin_project::__private::Unpin, + {} + trait EnumMustNotImplDrop {} + #[allow(clippy::drop_bounds, drop_bounds)] + impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {} + impl<T, U> EnumMustNotImplDrop for Enum<T, U> {} + #[doc(hidden)] + impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + } +}; +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/enum-all.rs b/third_party/rust/pin-project/tests/expand/naming/enum-all.rs new file mode 100644 index 0000000000..dd513e6c36 --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/enum-all.rs @@ -0,0 +1,14 @@ +use pin_project::pin_project; + +#[pin_project(project = Proj, project_ref = ProjRef, project_replace = ProjOwn)] +enum Enum<T, U> { + Struct { + #[pin] + pinned: T, + unpinned: U, + }, + Tuple(#[pin] T, U), + Unit, +} + +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/enum-mut.expanded.rs b/third_party/rust/pin-project/tests/expand/naming/enum-mut.expanded.rs new file mode 100644 index 0000000000..c6916ece85 --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/enum-mut.expanded.rs @@ -0,0 +1,99 @@ +use pin_project::pin_project; +#[pin(__private(project = Proj))] +enum Enum<T, U> { + Struct { #[pin] pinned: T, unpinned: U }, + Tuple(#[pin] T, U), + Unit, +} +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(dead_code)] +#[allow(clippy::mut_mut)] +enum Proj<'pin, T, U> +where + Enum<T, U>: 'pin, +{ + Struct { + pinned: ::pin_project::__private::Pin<&'pin mut (T)>, + unpinned: &'pin mut (U), + }, + Tuple(::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U)), + Unit, +} +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] +#[allow(clippy::semicolon_if_nothing_returned)] +#[allow(clippy::use_self)] +#[allow(clippy::used_underscore_binding)] +const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; + impl<T, U> Enum<T, U> { + #[allow(dead_code)] + fn project<'pin>( + self: _pin_project::__private::Pin<&'pin mut Self>, + ) -> Proj<'pin, T, U> { + unsafe { + match self.get_unchecked_mut() { + Self::Struct { pinned, unpinned } => { + Proj::Struct { + pinned: _pin_project::__private::Pin::new_unchecked(pinned), + unpinned, + } + } + Self::Tuple(_0, _1) => { + Proj::Tuple(_pin_project::__private::Pin::new_unchecked(_0), _1) + } + Self::Unit => Proj::Unit, + } + } + } + } + #[allow(missing_debug_implementations)] + struct __Enum<'pin, T, U> { + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + 'pin, + ( + _pin_project::__private::PhantomData<T>, + _pin_project::__private::PhantomData<U>, + ), + >, + __field0: T, + __field1: T, + } + impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U> + where + __Enum<'pin, T, U>: _pin_project::__private::Unpin, + {} + #[doc(hidden)] + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum<T, U> + where + __Enum<'pin, T, U>: _pin_project::__private::Unpin, + {} + trait EnumMustNotImplDrop {} + #[allow(clippy::drop_bounds, drop_bounds)] + impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {} + impl<T, U> EnumMustNotImplDrop for Enum<T, U> {} + #[doc(hidden)] + impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + } +}; +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/enum-mut.rs b/third_party/rust/pin-project/tests/expand/naming/enum-mut.rs new file mode 100644 index 0000000000..818276f39c --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/enum-mut.rs @@ -0,0 +1,14 @@ +use pin_project::pin_project; + +#[pin_project(project = Proj)] +enum Enum<T, U> { + Struct { + #[pin] + pinned: T, + unpinned: U, + }, + Tuple(#[pin] T, U), + Unit, +} + +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/enum-none.expanded.rs b/third_party/rust/pin-project/tests/expand/naming/enum-none.expanded.rs new file mode 100644 index 0000000000..46477d1e9d --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/enum-none.expanded.rs @@ -0,0 +1,56 @@ +use pin_project::pin_project; +#[pin(__private())] +enum Enum<T, U> { + Struct { #[pin] pinned: T, unpinned: U }, + Tuple(#[pin] T, U), + Unit, +} +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] +#[allow(clippy::semicolon_if_nothing_returned)] +#[allow(clippy::use_self)] +#[allow(clippy::used_underscore_binding)] +const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; + impl<T, U> Enum<T, U> {} + #[allow(missing_debug_implementations)] + struct __Enum<'pin, T, U> { + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + 'pin, + ( + _pin_project::__private::PhantomData<T>, + _pin_project::__private::PhantomData<U>, + ), + >, + __field0: T, + __field1: T, + } + impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U> + where + __Enum<'pin, T, U>: _pin_project::__private::Unpin, + {} + #[doc(hidden)] + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum<T, U> + where + __Enum<'pin, T, U>: _pin_project::__private::Unpin, + {} + trait EnumMustNotImplDrop {} + #[allow(clippy::drop_bounds, drop_bounds)] + impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {} + impl<T, U> EnumMustNotImplDrop for Enum<T, U> {} + #[doc(hidden)] + impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + } +}; +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/enum-none.rs b/third_party/rust/pin-project/tests/expand/naming/enum-none.rs new file mode 100644 index 0000000000..a87438db38 --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/enum-none.rs @@ -0,0 +1,14 @@ +use pin_project::pin_project; + +#[pin_project] +enum Enum<T, U> { + Struct { + #[pin] + pinned: T, + unpinned: U, + }, + Tuple(#[pin] T, U), + Unit, +} + +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/enum-own.expanded.rs b/third_party/rust/pin-project/tests/expand/naming/enum-own.expanded.rs new file mode 100644 index 0000000000..ddeb00c4b5 --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/enum-own.expanded.rs @@ -0,0 +1,119 @@ +use pin_project::pin_project; +#[pin(__private(project_replace = ProjOwn))] +enum Enum<T, U> { + Struct { #[pin] pinned: T, unpinned: U }, + Tuple(#[pin] T, U), + Unit, +} +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(dead_code)] +#[allow(variant_size_differences)] +#[allow(clippy::large_enum_variant)] +enum ProjOwn<T, U> { + Struct { pinned: ::pin_project::__private::PhantomData<T>, unpinned: U }, + Tuple(::pin_project::__private::PhantomData<T>, U), + Unit, +} +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] +#[allow(clippy::semicolon_if_nothing_returned)] +#[allow(clippy::use_self)] +#[allow(clippy::used_underscore_binding)] +const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; + impl<T, U> Enum<T, U> { + #[allow(dead_code)] + fn project_replace( + self: _pin_project::__private::Pin<&mut Self>, + __replacement: Self, + ) -> ProjOwn<T, U> { + unsafe { + let __self_ptr: *mut Self = self.get_unchecked_mut(); + let __guard = _pin_project::__private::UnsafeOverwriteGuard::new( + __self_ptr, + __replacement, + ); + match &mut *__self_ptr { + Self::Struct { pinned, unpinned } => { + let __result = ProjOwn::Struct { + pinned: _pin_project::__private::PhantomData, + unpinned: _pin_project::__private::ptr::read(unpinned), + }; + { + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new( + pinned, + ); + } + __result + } + Self::Tuple(_0, _1) => { + let __result = ProjOwn::Tuple( + _pin_project::__private::PhantomData, + _pin_project::__private::ptr::read(_1), + ); + { + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new( + _0, + ); + } + __result + } + Self::Unit => { + let __result = ProjOwn::Unit; + {} + __result + } + } + } + } + } + #[allow(missing_debug_implementations)] + struct __Enum<'pin, T, U> { + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + 'pin, + ( + _pin_project::__private::PhantomData<T>, + _pin_project::__private::PhantomData<U>, + ), + >, + __field0: T, + __field1: T, + } + impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U> + where + __Enum<'pin, T, U>: _pin_project::__private::Unpin, + {} + #[doc(hidden)] + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum<T, U> + where + __Enum<'pin, T, U>: _pin_project::__private::Unpin, + {} + trait EnumMustNotImplDrop {} + #[allow(clippy::drop_bounds, drop_bounds)] + impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {} + impl<T, U> EnumMustNotImplDrop for Enum<T, U> {} + #[doc(hidden)] + impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + } +}; +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/enum-own.rs b/third_party/rust/pin-project/tests/expand/naming/enum-own.rs new file mode 100644 index 0000000000..cf886974db --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/enum-own.rs @@ -0,0 +1,14 @@ +use pin_project::pin_project; + +#[pin_project(project_replace = ProjOwn)] +enum Enum<T, U> { + Struct { + #[pin] + pinned: T, + unpinned: U, + }, + Tuple(#[pin] T, U), + Unit, +} + +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/enum-ref.expanded.rs b/third_party/rust/pin-project/tests/expand/naming/enum-ref.expanded.rs new file mode 100644 index 0000000000..1a49584e75 --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/enum-ref.expanded.rs @@ -0,0 +1,100 @@ +use pin_project::pin_project; +#[pin(__private(project_ref = ProjRef))] +enum Enum<T, U> { + Struct { #[pin] pinned: T, unpinned: U }, + Tuple(#[pin] T, U), + Unit, +} +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(dead_code)] +#[allow(clippy::ref_option_ref)] +enum ProjRef<'pin, T, U> +where + Enum<T, U>: 'pin, +{ + Struct { pinned: ::pin_project::__private::Pin<&'pin (T)>, unpinned: &'pin (U) }, + Tuple(::pin_project::__private::Pin<&'pin (T)>, &'pin (U)), + Unit, +} +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] +#[allow(clippy::semicolon_if_nothing_returned)] +#[allow(clippy::use_self)] +#[allow(clippy::used_underscore_binding)] +const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; + impl<T, U> Enum<T, U> { + #[allow(dead_code)] + #[allow(clippy::missing_const_for_fn)] + fn project_ref<'pin>( + self: _pin_project::__private::Pin<&'pin Self>, + ) -> ProjRef<'pin, T, U> { + unsafe { + match self.get_ref() { + Self::Struct { pinned, unpinned } => { + ProjRef::Struct { + pinned: _pin_project::__private::Pin::new_unchecked(pinned), + unpinned, + } + } + Self::Tuple(_0, _1) => { + ProjRef::Tuple( + _pin_project::__private::Pin::new_unchecked(_0), + _1, + ) + } + Self::Unit => ProjRef::Unit, + } + } + } + } + #[allow(missing_debug_implementations)] + struct __Enum<'pin, T, U> { + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + 'pin, + ( + _pin_project::__private::PhantomData<T>, + _pin_project::__private::PhantomData<U>, + ), + >, + __field0: T, + __field1: T, + } + impl<'pin, T, U> _pin_project::__private::Unpin for Enum<T, U> + where + __Enum<'pin, T, U>: _pin_project::__private::Unpin, + {} + #[doc(hidden)] + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Enum<T, U> + where + __Enum<'pin, T, U>: _pin_project::__private::Unpin, + {} + trait EnumMustNotImplDrop {} + #[allow(clippy::drop_bounds, drop_bounds)] + impl<T: _pin_project::__private::Drop> EnumMustNotImplDrop for T {} + impl<T, U> EnumMustNotImplDrop for Enum<T, U> {} + #[doc(hidden)] + impl<T, U> _pin_project::__private::PinnedDrop for Enum<T, U> { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + } +}; +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/enum-ref.rs b/third_party/rust/pin-project/tests/expand/naming/enum-ref.rs new file mode 100644 index 0000000000..b1ff805ce5 --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/enum-ref.rs @@ -0,0 +1,14 @@ +use pin_project::pin_project; + +#[pin_project(project_ref = ProjRef)] +enum Enum<T, U> { + Struct { + #[pin] + pinned: T, + unpinned: U, + }, + Tuple(#[pin] T, U), + Unit, +} + +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/struct-all.expanded.rs b/third_party/rust/pin-project/tests/expand/naming/struct-all.expanded.rs new file mode 100644 index 0000000000..e598a4f354 --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/struct-all.expanded.rs @@ -0,0 +1,163 @@ +use pin_project::pin_project; +#[pin(__private(project = Proj, project_ref = ProjRef, project_replace = ProjOwn))] +struct Struct<T, U> { + #[pin] + pinned: T, + unpinned: U, +} +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(dead_code)] +#[allow(clippy::mut_mut)] +struct Proj<'pin, T, U> +where + Struct<T, U>: 'pin, +{ + pinned: ::pin_project::__private::Pin<&'pin mut (T)>, + unpinned: &'pin mut (U), +} +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(dead_code)] +#[allow(clippy::ref_option_ref)] +struct ProjRef<'pin, T, U> +where + Struct<T, U>: 'pin, +{ + pinned: ::pin_project::__private::Pin<&'pin (T)>, + unpinned: &'pin (U), +} +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(dead_code)] +struct ProjOwn<T, U> { + pinned: ::pin_project::__private::PhantomData<T>, + unpinned: U, +} +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] +#[allow(clippy::semicolon_if_nothing_returned)] +#[allow(clippy::use_self)] +#[allow(clippy::used_underscore_binding)] +const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; + impl<T, U> Struct<T, U> { + #[allow(dead_code)] + fn project<'pin>( + self: _pin_project::__private::Pin<&'pin mut Self>, + ) -> Proj<'pin, T, U> { + unsafe { + let Self { pinned, unpinned } = self.get_unchecked_mut(); + Proj { + pinned: _pin_project::__private::Pin::new_unchecked(pinned), + unpinned, + } + } + } + #[allow(dead_code)] + #[allow(clippy::missing_const_for_fn)] + fn project_ref<'pin>( + self: _pin_project::__private::Pin<&'pin Self>, + ) -> ProjRef<'pin, T, U> { + unsafe { + let Self { pinned, unpinned } = self.get_ref(); + ProjRef { + pinned: _pin_project::__private::Pin::new_unchecked(pinned), + unpinned, + } + } + } + #[allow(dead_code)] + fn project_replace( + self: _pin_project::__private::Pin<&mut Self>, + __replacement: Self, + ) -> ProjOwn<T, U> { + unsafe { + let __self_ptr: *mut Self = self.get_unchecked_mut(); + let __guard = _pin_project::__private::UnsafeOverwriteGuard::new( + __self_ptr, + __replacement, + ); + let Self { pinned, unpinned } = &mut *__self_ptr; + let __result = ProjOwn { + pinned: _pin_project::__private::PhantomData, + unpinned: _pin_project::__private::ptr::read(unpinned), + }; + { + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new( + pinned, + ); + } + __result + } + } + } + #[forbid(unaligned_references, safe_packed_borrows)] + fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { + let _ = &this.pinned; + let _ = &this.unpinned; + } + #[allow(missing_debug_implementations)] + struct __Struct<'pin, T, U> { + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + 'pin, + ( + _pin_project::__private::PhantomData<T>, + _pin_project::__private::PhantomData<U>, + ), + >, + __field0: T, + } + impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U> + where + __Struct<'pin, T, U>: _pin_project::__private::Unpin, + {} + #[doc(hidden)] + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct<T, U> + where + __Struct<'pin, T, U>: _pin_project::__private::Unpin, + {} + trait StructMustNotImplDrop {} + #[allow(clippy::drop_bounds, drop_bounds)] + impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {} + impl<T, U> StructMustNotImplDrop for Struct<T, U> {} + #[doc(hidden)] + impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + } +}; +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/struct-all.rs b/third_party/rust/pin-project/tests/expand/naming/struct-all.rs new file mode 100644 index 0000000000..c229ba4e0e --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/struct-all.rs @@ -0,0 +1,10 @@ +use pin_project::pin_project; + +#[pin_project(project = Proj, project_ref = ProjRef, project_replace = ProjOwn)] +struct Struct<T, U> { + #[pin] + pinned: T, + unpinned: U, +} + +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/struct-mut.expanded.rs b/third_party/rust/pin-project/tests/expand/naming/struct-mut.expanded.rs new file mode 100644 index 0000000000..88782ee253 --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/struct-mut.expanded.rs @@ -0,0 +1,114 @@ +use pin_project::pin_project; +#[pin(__private(project = Proj))] +struct Struct<T, U> { + #[pin] + pinned: T, + unpinned: U, +} +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(dead_code)] +#[allow(clippy::mut_mut)] +struct Proj<'pin, T, U> +where + Struct<T, U>: 'pin, +{ + pinned: ::pin_project::__private::Pin<&'pin mut (T)>, + unpinned: &'pin mut (U), +} +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] +#[allow(clippy::semicolon_if_nothing_returned)] +#[allow(clippy::use_self)] +#[allow(clippy::used_underscore_binding)] +const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; + #[allow(dead_code)] + #[allow(clippy::ref_option_ref)] + struct __StructProjectionRef<'pin, T, U> + where + Struct<T, U>: 'pin, + { + pinned: ::pin_project::__private::Pin<&'pin (T)>, + unpinned: &'pin (U), + } + impl<T, U> Struct<T, U> { + #[allow(dead_code)] + fn project<'pin>( + self: _pin_project::__private::Pin<&'pin mut Self>, + ) -> Proj<'pin, T, U> { + unsafe { + let Self { pinned, unpinned } = self.get_unchecked_mut(); + Proj { + pinned: _pin_project::__private::Pin::new_unchecked(pinned), + unpinned, + } + } + } + #[allow(dead_code)] + #[allow(clippy::missing_const_for_fn)] + fn project_ref<'pin>( + self: _pin_project::__private::Pin<&'pin Self>, + ) -> __StructProjectionRef<'pin, T, U> { + unsafe { + let Self { pinned, unpinned } = self.get_ref(); + __StructProjectionRef { + pinned: _pin_project::__private::Pin::new_unchecked(pinned), + unpinned, + } + } + } + } + #[forbid(unaligned_references, safe_packed_borrows)] + fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { + let _ = &this.pinned; + let _ = &this.unpinned; + } + #[allow(missing_debug_implementations)] + struct __Struct<'pin, T, U> { + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + 'pin, + ( + _pin_project::__private::PhantomData<T>, + _pin_project::__private::PhantomData<U>, + ), + >, + __field0: T, + } + impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U> + where + __Struct<'pin, T, U>: _pin_project::__private::Unpin, + {} + #[doc(hidden)] + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct<T, U> + where + __Struct<'pin, T, U>: _pin_project::__private::Unpin, + {} + trait StructMustNotImplDrop {} + #[allow(clippy::drop_bounds, drop_bounds)] + impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {} + impl<T, U> StructMustNotImplDrop for Struct<T, U> {} + #[doc(hidden)] + impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + } +}; +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/struct-mut.rs b/third_party/rust/pin-project/tests/expand/naming/struct-mut.rs new file mode 100644 index 0000000000..2f554d324d --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/struct-mut.rs @@ -0,0 +1,10 @@ +use pin_project::pin_project; + +#[pin_project(project = Proj)] +struct Struct<T, U> { + #[pin] + pinned: T, + unpinned: U, +} + +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/struct-none.expanded.rs b/third_party/rust/pin-project/tests/expand/naming/struct-none.expanded.rs new file mode 100644 index 0000000000..0005d863c4 --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/struct-none.expanded.rs @@ -0,0 +1,104 @@ +use pin_project::pin_project; +#[pin(__private())] +struct Struct<T, U> { + #[pin] + pinned: T, + unpinned: U, +} +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] +#[allow(clippy::semicolon_if_nothing_returned)] +#[allow(clippy::use_self)] +#[allow(clippy::used_underscore_binding)] +const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; + #[allow(dead_code)] + #[allow(clippy::mut_mut)] + struct __StructProjection<'pin, T, U> + where + Struct<T, U>: 'pin, + { + pinned: ::pin_project::__private::Pin<&'pin mut (T)>, + unpinned: &'pin mut (U), + } + #[allow(dead_code)] + #[allow(clippy::ref_option_ref)] + struct __StructProjectionRef<'pin, T, U> + where + Struct<T, U>: 'pin, + { + pinned: ::pin_project::__private::Pin<&'pin (T)>, + unpinned: &'pin (U), + } + impl<T, U> Struct<T, U> { + #[allow(dead_code)] + fn project<'pin>( + self: _pin_project::__private::Pin<&'pin mut Self>, + ) -> __StructProjection<'pin, T, U> { + unsafe { + let Self { pinned, unpinned } = self.get_unchecked_mut(); + __StructProjection { + pinned: _pin_project::__private::Pin::new_unchecked(pinned), + unpinned, + } + } + } + #[allow(dead_code)] + #[allow(clippy::missing_const_for_fn)] + fn project_ref<'pin>( + self: _pin_project::__private::Pin<&'pin Self>, + ) -> __StructProjectionRef<'pin, T, U> { + unsafe { + let Self { pinned, unpinned } = self.get_ref(); + __StructProjectionRef { + pinned: _pin_project::__private::Pin::new_unchecked(pinned), + unpinned, + } + } + } + } + #[forbid(unaligned_references, safe_packed_borrows)] + fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { + let _ = &this.pinned; + let _ = &this.unpinned; + } + #[allow(missing_debug_implementations)] + struct __Struct<'pin, T, U> { + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + 'pin, + ( + _pin_project::__private::PhantomData<T>, + _pin_project::__private::PhantomData<U>, + ), + >, + __field0: T, + } + impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U> + where + __Struct<'pin, T, U>: _pin_project::__private::Unpin, + {} + #[doc(hidden)] + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct<T, U> + where + __Struct<'pin, T, U>: _pin_project::__private::Unpin, + {} + trait StructMustNotImplDrop {} + #[allow(clippy::drop_bounds, drop_bounds)] + impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {} + impl<T, U> StructMustNotImplDrop for Struct<T, U> {} + #[doc(hidden)] + impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + } +}; +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/struct-none.rs b/third_party/rust/pin-project/tests/expand/naming/struct-none.rs new file mode 100644 index 0000000000..474f0a1161 --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/struct-none.rs @@ -0,0 +1,10 @@ +use pin_project::pin_project; + +#[pin_project] +struct Struct<T, U> { + #[pin] + pinned: T, + unpinned: U, +} + +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/struct-own.expanded.rs b/third_party/rust/pin-project/tests/expand/naming/struct-own.expanded.rs new file mode 100644 index 0000000000..cc248628a9 --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/struct-own.expanded.rs @@ -0,0 +1,143 @@ +use pin_project::pin_project; +#[pin(__private(project_replace = ProjOwn))] +struct Struct<T, U> { + #[pin] + pinned: T, + unpinned: U, +} +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(dead_code)] +struct ProjOwn<T, U> { + pinned: ::pin_project::__private::PhantomData<T>, + unpinned: U, +} +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] +#[allow(clippy::semicolon_if_nothing_returned)] +#[allow(clippy::use_self)] +#[allow(clippy::used_underscore_binding)] +const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; + #[allow(dead_code)] + #[allow(clippy::mut_mut)] + struct __StructProjection<'pin, T, U> + where + Struct<T, U>: 'pin, + { + pinned: ::pin_project::__private::Pin<&'pin mut (T)>, + unpinned: &'pin mut (U), + } + #[allow(dead_code)] + #[allow(clippy::ref_option_ref)] + struct __StructProjectionRef<'pin, T, U> + where + Struct<T, U>: 'pin, + { + pinned: ::pin_project::__private::Pin<&'pin (T)>, + unpinned: &'pin (U), + } + impl<T, U> Struct<T, U> { + #[allow(dead_code)] + fn project<'pin>( + self: _pin_project::__private::Pin<&'pin mut Self>, + ) -> __StructProjection<'pin, T, U> { + unsafe { + let Self { pinned, unpinned } = self.get_unchecked_mut(); + __StructProjection { + pinned: _pin_project::__private::Pin::new_unchecked(pinned), + unpinned, + } + } + } + #[allow(dead_code)] + #[allow(clippy::missing_const_for_fn)] + fn project_ref<'pin>( + self: _pin_project::__private::Pin<&'pin Self>, + ) -> __StructProjectionRef<'pin, T, U> { + unsafe { + let Self { pinned, unpinned } = self.get_ref(); + __StructProjectionRef { + pinned: _pin_project::__private::Pin::new_unchecked(pinned), + unpinned, + } + } + } + #[allow(dead_code)] + fn project_replace( + self: _pin_project::__private::Pin<&mut Self>, + __replacement: Self, + ) -> ProjOwn<T, U> { + unsafe { + let __self_ptr: *mut Self = self.get_unchecked_mut(); + let __guard = _pin_project::__private::UnsafeOverwriteGuard::new( + __self_ptr, + __replacement, + ); + let Self { pinned, unpinned } = &mut *__self_ptr; + let __result = ProjOwn { + pinned: _pin_project::__private::PhantomData, + unpinned: _pin_project::__private::ptr::read(unpinned), + }; + { + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new( + pinned, + ); + } + __result + } + } + } + #[forbid(unaligned_references, safe_packed_borrows)] + fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { + let _ = &this.pinned; + let _ = &this.unpinned; + } + #[allow(missing_debug_implementations)] + struct __Struct<'pin, T, U> { + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + 'pin, + ( + _pin_project::__private::PhantomData<T>, + _pin_project::__private::PhantomData<U>, + ), + >, + __field0: T, + } + impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U> + where + __Struct<'pin, T, U>: _pin_project::__private::Unpin, + {} + #[doc(hidden)] + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct<T, U> + where + __Struct<'pin, T, U>: _pin_project::__private::Unpin, + {} + trait StructMustNotImplDrop {} + #[allow(clippy::drop_bounds, drop_bounds)] + impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {} + impl<T, U> StructMustNotImplDrop for Struct<T, U> {} + #[doc(hidden)] + impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + } +}; +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/struct-own.rs b/third_party/rust/pin-project/tests/expand/naming/struct-own.rs new file mode 100644 index 0000000000..4924362ba0 --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/struct-own.rs @@ -0,0 +1,10 @@ +use pin_project::pin_project; + +#[pin_project(project_replace = ProjOwn)] +struct Struct<T, U> { + #[pin] + pinned: T, + unpinned: U, +} + +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/struct-ref.expanded.rs b/third_party/rust/pin-project/tests/expand/naming/struct-ref.expanded.rs new file mode 100644 index 0000000000..e392f6f9c3 --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/struct-ref.expanded.rs @@ -0,0 +1,114 @@ +use pin_project::pin_project; +#[pin(__private(project_ref = ProjRef))] +struct Struct<T, U> { + #[pin] + pinned: T, + unpinned: U, +} +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(dead_code)] +#[allow(clippy::ref_option_ref)] +struct ProjRef<'pin, T, U> +where + Struct<T, U>: 'pin, +{ + pinned: ::pin_project::__private::Pin<&'pin (T)>, + unpinned: &'pin (U), +} +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] +#[allow(clippy::semicolon_if_nothing_returned)] +#[allow(clippy::use_self)] +#[allow(clippy::used_underscore_binding)] +const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; + #[allow(dead_code)] + #[allow(clippy::mut_mut)] + struct __StructProjection<'pin, T, U> + where + Struct<T, U>: 'pin, + { + pinned: ::pin_project::__private::Pin<&'pin mut (T)>, + unpinned: &'pin mut (U), + } + impl<T, U> Struct<T, U> { + #[allow(dead_code)] + fn project<'pin>( + self: _pin_project::__private::Pin<&'pin mut Self>, + ) -> __StructProjection<'pin, T, U> { + unsafe { + let Self { pinned, unpinned } = self.get_unchecked_mut(); + __StructProjection { + pinned: _pin_project::__private::Pin::new_unchecked(pinned), + unpinned, + } + } + } + #[allow(dead_code)] + #[allow(clippy::missing_const_for_fn)] + fn project_ref<'pin>( + self: _pin_project::__private::Pin<&'pin Self>, + ) -> ProjRef<'pin, T, U> { + unsafe { + let Self { pinned, unpinned } = self.get_ref(); + ProjRef { + pinned: _pin_project::__private::Pin::new_unchecked(pinned), + unpinned, + } + } + } + } + #[forbid(unaligned_references, safe_packed_borrows)] + fn __assert_not_repr_packed<T, U>(this: &Struct<T, U>) { + let _ = &this.pinned; + let _ = &this.unpinned; + } + #[allow(missing_debug_implementations)] + struct __Struct<'pin, T, U> { + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + 'pin, + ( + _pin_project::__private::PhantomData<T>, + _pin_project::__private::PhantomData<U>, + ), + >, + __field0: T, + } + impl<'pin, T, U> _pin_project::__private::Unpin for Struct<T, U> + where + __Struct<'pin, T, U>: _pin_project::__private::Unpin, + {} + #[doc(hidden)] + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for Struct<T, U> + where + __Struct<'pin, T, U>: _pin_project::__private::Unpin, + {} + trait StructMustNotImplDrop {} + #[allow(clippy::drop_bounds, drop_bounds)] + impl<T: _pin_project::__private::Drop> StructMustNotImplDrop for T {} + impl<T, U> StructMustNotImplDrop for Struct<T, U> {} + #[doc(hidden)] + impl<T, U> _pin_project::__private::PinnedDrop for Struct<T, U> { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + } +}; +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/struct-ref.rs b/third_party/rust/pin-project/tests/expand/naming/struct-ref.rs new file mode 100644 index 0000000000..4e29a162d4 --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/struct-ref.rs @@ -0,0 +1,10 @@ +use pin_project::pin_project; + +#[pin_project(project_ref = ProjRef)] +struct Struct<T, U> { + #[pin] + pinned: T, + unpinned: U, +} + +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/tuple_struct-all.expanded.rs b/third_party/rust/pin-project/tests/expand/naming/tuple_struct-all.expanded.rs new file mode 100644 index 0000000000..8c148ed95b --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/tuple_struct-all.expanded.rs @@ -0,0 +1,148 @@ +use pin_project::pin_project; +#[pin(__private(project = Proj, project_ref = ProjRef, project_replace = ProjOwn))] +struct TupleStruct<T, U>(#[pin] T, U); +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(dead_code)] +#[allow(clippy::mut_mut)] +struct Proj<'pin, T, U>( + ::pin_project::__private::Pin<&'pin mut (T)>, + &'pin mut (U), +) +where + TupleStruct<T, U>: 'pin; +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(dead_code)] +#[allow(clippy::ref_option_ref)] +struct ProjRef<'pin, T, U>( + ::pin_project::__private::Pin<&'pin (T)>, + &'pin (U), +) +where + TupleStruct<T, U>: 'pin; +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(dead_code)] +struct ProjOwn<T, U>(::pin_project::__private::PhantomData<T>, U); +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] +#[allow(clippy::semicolon_if_nothing_returned)] +#[allow(clippy::use_self)] +#[allow(clippy::used_underscore_binding)] +const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; + impl<T, U> TupleStruct<T, U> { + #[allow(dead_code)] + fn project<'pin>( + self: _pin_project::__private::Pin<&'pin mut Self>, + ) -> Proj<'pin, T, U> { + unsafe { + let Self(_0, _1) = self.get_unchecked_mut(); + Proj(_pin_project::__private::Pin::new_unchecked(_0), _1) + } + } + #[allow(dead_code)] + #[allow(clippy::missing_const_for_fn)] + fn project_ref<'pin>( + self: _pin_project::__private::Pin<&'pin Self>, + ) -> ProjRef<'pin, T, U> { + unsafe { + let Self(_0, _1) = self.get_ref(); + ProjRef(_pin_project::__private::Pin::new_unchecked(_0), _1) + } + } + #[allow(dead_code)] + fn project_replace( + self: _pin_project::__private::Pin<&mut Self>, + __replacement: Self, + ) -> ProjOwn<T, U> { + unsafe { + let __self_ptr: *mut Self = self.get_unchecked_mut(); + let __guard = _pin_project::__private::UnsafeOverwriteGuard::new( + __self_ptr, + __replacement, + ); + let Self(_0, _1) = &mut *__self_ptr; + let __result = ProjOwn( + _pin_project::__private::PhantomData, + _pin_project::__private::ptr::read(_1), + ); + { + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new( + _0, + ); + } + __result + } + } + } + #[forbid(unaligned_references, safe_packed_borrows)] + fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) { + let _ = &this.0; + let _ = &this.1; + } + #[allow(missing_debug_implementations)] + struct __TupleStruct<'pin, T, U> { + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + 'pin, + ( + _pin_project::__private::PhantomData<T>, + _pin_project::__private::PhantomData<U>, + ), + >, + __field0: T, + } + impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U> + where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin, + {} + #[doc(hidden)] + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct<T, U> + where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin, + {} + trait TupleStructMustNotImplDrop {} + #[allow(clippy::drop_bounds, drop_bounds)] + impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} + impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {} + #[doc(hidden)] + impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + } +}; +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/tuple_struct-all.rs b/third_party/rust/pin-project/tests/expand/naming/tuple_struct-all.rs new file mode 100644 index 0000000000..0d95cb0080 --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/tuple_struct-all.rs @@ -0,0 +1,6 @@ +use pin_project::pin_project; + +#[pin_project(project = Proj, project_ref = ProjRef, project_replace = ProjOwn)] +struct TupleStruct<T, U>(#[pin] T, U); + +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/tuple_struct-mut.expanded.rs b/third_party/rust/pin-project/tests/expand/naming/tuple_struct-mut.expanded.rs new file mode 100644 index 0000000000..79c790100d --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/tuple_struct-mut.expanded.rs @@ -0,0 +1,105 @@ +use pin_project::pin_project; +#[pin(__private(project = Proj))] +struct TupleStruct<T, U>(#[pin] T, U); +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(dead_code)] +#[allow(clippy::mut_mut)] +struct Proj<'pin, T, U>( + ::pin_project::__private::Pin<&'pin mut (T)>, + &'pin mut (U), +) +where + TupleStruct<T, U>: 'pin; +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] +#[allow(clippy::semicolon_if_nothing_returned)] +#[allow(clippy::use_self)] +#[allow(clippy::used_underscore_binding)] +const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; + #[allow(dead_code)] + #[allow(clippy::ref_option_ref)] + struct __TupleStructProjectionRef<'pin, T, U>( + ::pin_project::__private::Pin<&'pin (T)>, + &'pin (U), + ) + where + TupleStruct<T, U>: 'pin; + impl<T, U> TupleStruct<T, U> { + #[allow(dead_code)] + fn project<'pin>( + self: _pin_project::__private::Pin<&'pin mut Self>, + ) -> Proj<'pin, T, U> { + unsafe { + let Self(_0, _1) = self.get_unchecked_mut(); + Proj(_pin_project::__private::Pin::new_unchecked(_0), _1) + } + } + #[allow(dead_code)] + #[allow(clippy::missing_const_for_fn)] + fn project_ref<'pin>( + self: _pin_project::__private::Pin<&'pin Self>, + ) -> __TupleStructProjectionRef<'pin, T, U> { + unsafe { + let Self(_0, _1) = self.get_ref(); + __TupleStructProjectionRef( + _pin_project::__private::Pin::new_unchecked(_0), + _1, + ) + } + } + } + #[forbid(unaligned_references, safe_packed_borrows)] + fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) { + let _ = &this.0; + let _ = &this.1; + } + #[allow(missing_debug_implementations)] + struct __TupleStruct<'pin, T, U> { + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + 'pin, + ( + _pin_project::__private::PhantomData<T>, + _pin_project::__private::PhantomData<U>, + ), + >, + __field0: T, + } + impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U> + where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin, + {} + #[doc(hidden)] + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct<T, U> + where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin, + {} + trait TupleStructMustNotImplDrop {} + #[allow(clippy::drop_bounds, drop_bounds)] + impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} + impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {} + #[doc(hidden)] + impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + } +}; +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/tuple_struct-mut.rs b/third_party/rust/pin-project/tests/expand/naming/tuple_struct-mut.rs new file mode 100644 index 0000000000..e9779a6cad --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/tuple_struct-mut.rs @@ -0,0 +1,6 @@ +use pin_project::pin_project; + +#[pin_project(project = Proj)] +struct TupleStruct<T, U>(#[pin] T, U); + +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/tuple_struct-none.expanded.rs b/third_party/rust/pin-project/tests/expand/naming/tuple_struct-none.expanded.rs new file mode 100644 index 0000000000..1c5e3b08be --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/tuple_struct-none.expanded.rs @@ -0,0 +1,98 @@ +use pin_project::pin_project; +#[pin(__private())] +struct TupleStruct<T, U>(#[pin] T, U); +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] +#[allow(clippy::semicolon_if_nothing_returned)] +#[allow(clippy::use_self)] +#[allow(clippy::used_underscore_binding)] +const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; + #[allow(dead_code)] + #[allow(clippy::mut_mut)] + struct __TupleStructProjection<'pin, T, U>( + ::pin_project::__private::Pin<&'pin mut (T)>, + &'pin mut (U), + ) + where + TupleStruct<T, U>: 'pin; + #[allow(dead_code)] + #[allow(clippy::ref_option_ref)] + struct __TupleStructProjectionRef<'pin, T, U>( + ::pin_project::__private::Pin<&'pin (T)>, + &'pin (U), + ) + where + TupleStruct<T, U>: 'pin; + impl<T, U> TupleStruct<T, U> { + #[allow(dead_code)] + fn project<'pin>( + self: _pin_project::__private::Pin<&'pin mut Self>, + ) -> __TupleStructProjection<'pin, T, U> { + unsafe { + let Self(_0, _1) = self.get_unchecked_mut(); + __TupleStructProjection( + _pin_project::__private::Pin::new_unchecked(_0), + _1, + ) + } + } + #[allow(dead_code)] + #[allow(clippy::missing_const_for_fn)] + fn project_ref<'pin>( + self: _pin_project::__private::Pin<&'pin Self>, + ) -> __TupleStructProjectionRef<'pin, T, U> { + unsafe { + let Self(_0, _1) = self.get_ref(); + __TupleStructProjectionRef( + _pin_project::__private::Pin::new_unchecked(_0), + _1, + ) + } + } + } + #[forbid(unaligned_references, safe_packed_borrows)] + fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) { + let _ = &this.0; + let _ = &this.1; + } + #[allow(missing_debug_implementations)] + struct __TupleStruct<'pin, T, U> { + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + 'pin, + ( + _pin_project::__private::PhantomData<T>, + _pin_project::__private::PhantomData<U>, + ), + >, + __field0: T, + } + impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U> + where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin, + {} + #[doc(hidden)] + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct<T, U> + where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin, + {} + trait TupleStructMustNotImplDrop {} + #[allow(clippy::drop_bounds, drop_bounds)] + impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} + impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {} + #[doc(hidden)] + impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + } +}; +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/tuple_struct-none.rs b/third_party/rust/pin-project/tests/expand/naming/tuple_struct-none.rs new file mode 100644 index 0000000000..398b14f3a5 --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/tuple_struct-none.rs @@ -0,0 +1,6 @@ +use pin_project::pin_project; + +#[pin_project] +struct TupleStruct<T, U>(#[pin] T, U); + +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/tuple_struct-own.expanded.rs b/third_party/rust/pin-project/tests/expand/naming/tuple_struct-own.expanded.rs new file mode 100644 index 0000000000..37e4c34373 --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/tuple_struct-own.expanded.rs @@ -0,0 +1,134 @@ +use pin_project::pin_project; +#[pin(__private(project_replace = ProjOwn))] +struct TupleStruct<T, U>(#[pin] T, U); +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(dead_code)] +struct ProjOwn<T, U>(::pin_project::__private::PhantomData<T>, U); +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] +#[allow(clippy::semicolon_if_nothing_returned)] +#[allow(clippy::use_self)] +#[allow(clippy::used_underscore_binding)] +const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; + #[allow(dead_code)] + #[allow(clippy::mut_mut)] + struct __TupleStructProjection<'pin, T, U>( + ::pin_project::__private::Pin<&'pin mut (T)>, + &'pin mut (U), + ) + where + TupleStruct<T, U>: 'pin; + #[allow(dead_code)] + #[allow(clippy::ref_option_ref)] + struct __TupleStructProjectionRef<'pin, T, U>( + ::pin_project::__private::Pin<&'pin (T)>, + &'pin (U), + ) + where + TupleStruct<T, U>: 'pin; + impl<T, U> TupleStruct<T, U> { + #[allow(dead_code)] + fn project<'pin>( + self: _pin_project::__private::Pin<&'pin mut Self>, + ) -> __TupleStructProjection<'pin, T, U> { + unsafe { + let Self(_0, _1) = self.get_unchecked_mut(); + __TupleStructProjection( + _pin_project::__private::Pin::new_unchecked(_0), + _1, + ) + } + } + #[allow(dead_code)] + #[allow(clippy::missing_const_for_fn)] + fn project_ref<'pin>( + self: _pin_project::__private::Pin<&'pin Self>, + ) -> __TupleStructProjectionRef<'pin, T, U> { + unsafe { + let Self(_0, _1) = self.get_ref(); + __TupleStructProjectionRef( + _pin_project::__private::Pin::new_unchecked(_0), + _1, + ) + } + } + #[allow(dead_code)] + fn project_replace( + self: _pin_project::__private::Pin<&mut Self>, + __replacement: Self, + ) -> ProjOwn<T, U> { + unsafe { + let __self_ptr: *mut Self = self.get_unchecked_mut(); + let __guard = _pin_project::__private::UnsafeOverwriteGuard::new( + __self_ptr, + __replacement, + ); + let Self(_0, _1) = &mut *__self_ptr; + let __result = ProjOwn( + _pin_project::__private::PhantomData, + _pin_project::__private::ptr::read(_1), + ); + { + let __guard = _pin_project::__private::UnsafeDropInPlaceGuard::new( + _0, + ); + } + __result + } + } + } + #[forbid(unaligned_references, safe_packed_borrows)] + fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) { + let _ = &this.0; + let _ = &this.1; + } + #[allow(missing_debug_implementations)] + struct __TupleStruct<'pin, T, U> { + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + 'pin, + ( + _pin_project::__private::PhantomData<T>, + _pin_project::__private::PhantomData<U>, + ), + >, + __field0: T, + } + impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U> + where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin, + {} + #[doc(hidden)] + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct<T, U> + where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin, + {} + trait TupleStructMustNotImplDrop {} + #[allow(clippy::drop_bounds, drop_bounds)] + impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} + impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {} + #[doc(hidden)] + impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + } +}; +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/tuple_struct-own.rs b/third_party/rust/pin-project/tests/expand/naming/tuple_struct-own.rs new file mode 100644 index 0000000000..a15ad4094a --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/tuple_struct-own.rs @@ -0,0 +1,6 @@ +use pin_project::pin_project; + +#[pin_project(project_replace = ProjOwn)] +struct TupleStruct<T, U>(#[pin] T, U); + +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/tuple_struct-ref.expanded.rs b/third_party/rust/pin-project/tests/expand/naming/tuple_struct-ref.expanded.rs new file mode 100644 index 0000000000..8c8686808c --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/tuple_struct-ref.expanded.rs @@ -0,0 +1,105 @@ +use pin_project::pin_project; +#[pin(__private(project_ref = ProjRef))] +struct TupleStruct<T, U>(#[pin] T, U); +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(dead_code)] +#[allow(clippy::ref_option_ref)] +struct ProjRef<'pin, T, U>( + ::pin_project::__private::Pin<&'pin (T)>, + &'pin (U), +) +where + TupleStruct<T, U>: 'pin; +#[allow(box_pointers)] +#[allow(deprecated)] +#[allow(explicit_outlives_requirements)] +#[allow(single_use_lifetimes)] +#[allow(unreachable_pub)] +#[allow(unused_tuple_struct_fields)] +#[allow(clippy::unknown_clippy_lints)] +#[allow(clippy::pattern_type_mismatch)] +#[allow(clippy::redundant_pub_crate)] +#[allow(clippy::type_repetition_in_bounds)] +#[allow(unused_qualifications)] +#[allow(clippy::semicolon_if_nothing_returned)] +#[allow(clippy::use_self)] +#[allow(clippy::used_underscore_binding)] +const _: () = { + #[allow(unused_extern_crates)] + extern crate pin_project as _pin_project; + #[allow(dead_code)] + #[allow(clippy::mut_mut)] + struct __TupleStructProjection<'pin, T, U>( + ::pin_project::__private::Pin<&'pin mut (T)>, + &'pin mut (U), + ) + where + TupleStruct<T, U>: 'pin; + impl<T, U> TupleStruct<T, U> { + #[allow(dead_code)] + fn project<'pin>( + self: _pin_project::__private::Pin<&'pin mut Self>, + ) -> __TupleStructProjection<'pin, T, U> { + unsafe { + let Self(_0, _1) = self.get_unchecked_mut(); + __TupleStructProjection( + _pin_project::__private::Pin::new_unchecked(_0), + _1, + ) + } + } + #[allow(dead_code)] + #[allow(clippy::missing_const_for_fn)] + fn project_ref<'pin>( + self: _pin_project::__private::Pin<&'pin Self>, + ) -> ProjRef<'pin, T, U> { + unsafe { + let Self(_0, _1) = self.get_ref(); + ProjRef(_pin_project::__private::Pin::new_unchecked(_0), _1) + } + } + } + #[forbid(unaligned_references, safe_packed_borrows)] + fn __assert_not_repr_packed<T, U>(this: &TupleStruct<T, U>) { + let _ = &this.0; + let _ = &this.1; + } + #[allow(missing_debug_implementations)] + struct __TupleStruct<'pin, T, U> { + __pin_project_use_generics: _pin_project::__private::AlwaysUnpin< + 'pin, + ( + _pin_project::__private::PhantomData<T>, + _pin_project::__private::PhantomData<U>, + ), + >, + __field0: T, + } + impl<'pin, T, U> _pin_project::__private::Unpin for TupleStruct<T, U> + where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin, + {} + #[doc(hidden)] + unsafe impl<'pin, T, U> _pin_project::UnsafeUnpin for TupleStruct<T, U> + where + __TupleStruct<'pin, T, U>: _pin_project::__private::Unpin, + {} + trait TupleStructMustNotImplDrop {} + #[allow(clippy::drop_bounds, drop_bounds)] + impl<T: _pin_project::__private::Drop> TupleStructMustNotImplDrop for T {} + impl<T, U> TupleStructMustNotImplDrop for TupleStruct<T, U> {} + #[doc(hidden)] + impl<T, U> _pin_project::__private::PinnedDrop for TupleStruct<T, U> { + unsafe fn drop(self: _pin_project::__private::Pin<&mut Self>) {} + } +}; +fn main() {} diff --git a/third_party/rust/pin-project/tests/expand/naming/tuple_struct-ref.rs b/third_party/rust/pin-project/tests/expand/naming/tuple_struct-ref.rs new file mode 100644 index 0000000000..cc61edfb79 --- /dev/null +++ b/third_party/rust/pin-project/tests/expand/naming/tuple_struct-ref.rs @@ -0,0 +1,6 @@ +use pin_project::pin_project; + +#[pin_project(project_ref = ProjRef)] +struct TupleStruct<T, U>(#[pin] T, U); + +fn main() {} |