diff --git a/src/cxx_auto_artifact_info.rs b/src/cxx_auto_artifact_info.rs index 3f253b6..58ad039 100644 --- a/src/cxx_auto_artifact_info.rs +++ b/src/cxx_auto_artifact_info.rs @@ -400,7 +400,7 @@ fn emit_impl_moveit_copy_new( #[inline] unsafe fn copy_new(that: &Self, this: ::core::pin::Pin<&mut ::core::mem::MaybeUninit>) { let this = this.get_unchecked_mut().as_mut_ptr(); - self::ffi::cxx_copy_new(this, that) + self::ffi::cxx_copy_new(this, that); } } }) @@ -426,7 +426,7 @@ fn emit_impl_moveit_move_new( ) { let this = this.get_unchecked_mut().as_mut_ptr(); let that = &mut *::core::pin::Pin::into_inner_unchecked(that); - self::ffi::cxx_move_new(this, that) + self::ffi::cxx_move_new(this, that); } } }) @@ -532,8 +532,15 @@ fn emit_impl_partial_ord( } else { None }; - Some(syn::parse_quote! { - impl #generics_binder ::core::cmp::PartialOrd for #ident #generics { + let partial_cmp: syn::ImplItemFn = if info.is_rust_ord { + syn::parse_quote! { + #[inline] + fn partial_cmp(&self, other: &Self) -> Option<::core::cmp::Ordering> { + Some(self.cmp(other)) + } + } + } else { + syn::parse_quote! { #[inline] fn partial_cmp(&self, other: &Self) -> Option<::core::cmp::Ordering> { let res = self::ffi::cxx_operator_three_way_comparison(self, other); @@ -548,6 +555,11 @@ fn emit_impl_partial_ord( None } } + } + }; + Some(syn::parse_quote! { + impl #generics_binder ::core::cmp::PartialOrd for #ident #generics { + #partial_cmp #lt #le #gt diff --git a/src/cxx_auto_entry.rs b/src/cxx_auto_entry.rs index 0be031c..cf4833c 100644 --- a/src/cxx_auto_entry.rs +++ b/src/cxx_auto_entry.rs @@ -45,7 +45,7 @@ impl<'ctx> CxxAutoEntry<'ctx> { let cxx_namespace = #cxx_namespace; let cxx_name = #cxx_name; let rust_name = #rust_name; - let lifetimes = ::cxx_auto::indexmap::IndexMap::from_iter([#(#lifetimes),*].into_iter()); + let lifetimes = ::cxx_auto::indexmap::IndexMap::from_iter([#(#lifetimes),*]); let align = self::ffi::cxx_abi_align(); let size = self::ffi::cxx_abi_size(); let cxx_has_operator_equal = self::ffi::cxx_has_operator_equal(); @@ -134,40 +134,75 @@ impl<'ctx> CxxAutoEntry<'ctx> { #namespace unsafe extern "C++" { include!(#include); + #[must_use] fn cxx_abi_align() -> usize; + #[must_use] fn cxx_abi_size() -> usize; + #[must_use] fn cxx_is_copy_constructible() -> bool; + #[must_use] fn cxx_is_move_constructible() -> bool; + #[must_use] fn cxx_is_default_constructible() -> bool; + #[must_use] fn cxx_is_destructible() -> bool; + #[must_use] fn cxx_is_trivially_copyable() -> bool; + #[must_use] fn cxx_is_trivially_movable() -> bool; + #[must_use] fn cxx_is_trivially_destructible() -> bool; + #[must_use] fn cxx_is_equality_comparable() -> bool; + #[must_use] fn cxx_has_operator_equal() -> bool; + #[must_use] fn cxx_has_operator_not_equal() -> bool; + #[must_use] fn cxx_has_operator_less_than() -> bool; + #[must_use] fn cxx_has_operator_less_than_or_equal() -> bool; + #[must_use] fn cxx_has_operator_greater_than() -> bool; + #[must_use] fn cxx_has_operator_greater_than_or_equal() -> bool; + #[must_use] fn cxx_is_partially_ordered() -> bool; + #[must_use] fn cxx_is_totally_ordered() -> bool; + #[must_use] fn cxx_is_hashable() -> bool; + #[must_use] fn rust_should_impl_cxx_extern_type_trivial() -> bool; + #[must_use] fn rust_should_impl_unpin() -> bool; + #[must_use] fn rust_should_impl_send() -> bool; + #[must_use] fn rust_should_impl_sync() -> bool; + #[must_use] fn rust_should_impl_copy() -> bool; + #[must_use] fn rust_should_impl_debug() -> bool; + #[must_use] fn rust_should_impl_default() -> bool; + #[must_use] fn rust_should_impl_display() -> bool; + #[must_use] fn rust_should_impl_drop() -> bool; + #[must_use] fn rust_should_impl_moveref_copy_new() -> bool; + #[must_use] fn rust_should_impl_moveref_move_new() -> bool; + #[must_use] fn rust_should_impl_eq() -> bool; + #[must_use] fn rust_should_impl_partial_eq() -> bool; + #[must_use] fn rust_should_impl_partial_ord() -> bool; + #[must_use] fn rust_should_impl_ord() -> bool; + #[must_use] fn rust_should_impl_hash() -> bool; } } diff --git a/src/processing.rs b/src/processing.rs index 64edbd2..9373e5a 100644 --- a/src/processing.rs +++ b/src/processing.rs @@ -191,6 +191,7 @@ fn emit_item_fn_process_artifact_infos<'a>( } }); syn::parse_quote! { + #[allow(clippy::missing_errors_doc)] pub fn process_artifacts(out_dir: &::std::path::Path) -> ::cxx_auto::BoxResult<()> { let auto_out_dir_root = &out_dir.join("src/auto"); #(#items)*