Use `#pragma clang lifetime_elision` in more golden tests.
I missed this in my earlier change. :(
PiperOrigin-RevId: 453741945
diff --git a/rs_bindings_from_cc/test/golden/clang_attrs.h b/rs_bindings_from_cc/test/golden/clang_attrs.h
index cad1e95..0bd1643 100644
--- a/rs_bindings_from_cc/test/golden/clang_attrs.h
+++ b/rs_bindings_from_cc/test/golden/clang_attrs.h
@@ -5,6 +5,8 @@
#ifndef CRUBIT_RS_BINDINGS_FROM_CC_TEST_GOLDEN_CLANG_ATTRS_H_
#define CRUBIT_RS_BINDINGS_FROM_CC_TEST_GOLDEN_CLANG_ATTRS_H_
+#pragma clang lifetime_elision
+
struct alignas(64) HasCustomAlignment {};
struct HasFieldWithCustomAlignment {
diff --git a/rs_bindings_from_cc/test/golden/clang_attrs_rs_api.rs b/rs_bindings_from_cc/test/golden/clang_attrs_rs_api.rs
index 495126d..309a8ff 100644
--- a/rs_bindings_from_cc/test/golden/clang_attrs_rs_api.rs
+++ b/rs_bindings_from_cc/test/golden/clang_attrs_rs_api.rs
@@ -5,7 +5,7 @@
// Automatically @generated Rust bindings for C++ target
// //rs_bindings_from_cc/test/golden:clang_attrs_cc
#![rustfmt::skip]
-#![feature(const_ptr_offset_from, custom_inner_attributes, negative_impls)]
+#![feature(const_ptr_offset_from, custom_inner_attributes, negative_impls, type_alias_impl_trait)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
@@ -27,25 +27,80 @@
crate::HasCustomAlignment
);
-// rs_bindings_from_cc/test/golden/clang_attrs.h;l=8
-// Error while generating bindings for item 'HasCustomAlignment::HasCustomAlignment':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl ctor::CtorNew<()> for HasCustomAlignment {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: ()) -> Self::CtorType {
+ let () = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN18HasCustomAlignmentC1Ev(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ );
+ },
+ )
+ }
+}
-// rs_bindings_from_cc/test/golden/clang_attrs.h;l=8
-// Error while generating bindings for item 'HasCustomAlignment::HasCustomAlignment':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl<'b> ctor::CtorNew<&'b crate::HasCustomAlignment> for HasCustomAlignment {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: &'b crate::HasCustomAlignment) -> Self::CtorType {
+ let __param_0 = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN18HasCustomAlignmentC1ERKS_(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ __param_0,
+ );
+ },
+ )
+ }
+}
+impl<'b> ctor::CtorNew<(&'b crate::HasCustomAlignment,)> for HasCustomAlignment {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: (&'b crate::HasCustomAlignment,)) -> Self::CtorType {
+ let (arg,) = args;
+ <Self as ctor::CtorNew<&'b crate::HasCustomAlignment>>::ctor_new(arg)
+ }
+}
-// rs_bindings_from_cc/test/golden/clang_attrs.h;l=8
-// Error while generating bindings for item 'HasCustomAlignment::HasCustomAlignment':
-// Parameter #0 is not supported: Unsupported type 'struct HasCustomAlignment &&': Unsupported type: && without lifetime
+impl<'b> ctor::CtorNew<ctor::RvalueReference<'b, crate::HasCustomAlignment>>
+ for HasCustomAlignment
+{
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: ctor::RvalueReference<'b, crate::HasCustomAlignment>) -> Self::CtorType {
+ let __param_0 = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN18HasCustomAlignmentC1EOS_(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ __param_0,
+ );
+ },
+ )
+ }
+}
+impl<'b> ctor::CtorNew<(ctor::RvalueReference<'b, crate::HasCustomAlignment>,)>
+ for HasCustomAlignment
+{
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: (ctor::RvalueReference<'b, crate::HasCustomAlignment>,)) -> Self::CtorType {
+ let (arg,) = args;
+ <Self as ctor::CtorNew<ctor::RvalueReference<'b, crate::HasCustomAlignment>>>::ctor_new(arg)
+ }
+}
-// rs_bindings_from_cc/test/golden/clang_attrs.h;l=8
+// rs_bindings_from_cc/test/golden/clang_attrs.h;l=10
// Error while generating bindings for item 'HasCustomAlignment::operator=':
// Bindings for this kind of operator are not supported
-// rs_bindings_from_cc/test/golden/clang_attrs.h;l=8
+// rs_bindings_from_cc/test/golden/clang_attrs.h;l=10
// Error while generating bindings for item 'HasCustomAlignment::operator=':
-// Parameter #0 is not supported: Unsupported type 'struct HasCustomAlignment &&': Unsupported type: && without lifetime
+// Bindings for this kind of operator are not supported
#[ctor::recursively_pinned]
#[repr(C)]
@@ -57,25 +112,84 @@
crate::HasFieldWithCustomAlignment
);
-// rs_bindings_from_cc/test/golden/clang_attrs.h;l=10
-// Error while generating bindings for item 'HasFieldWithCustomAlignment::HasFieldWithCustomAlignment':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl ctor::CtorNew<()> for HasFieldWithCustomAlignment {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: ()) -> Self::CtorType {
+ let () = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN27HasFieldWithCustomAlignmentC1Ev(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ );
+ },
+ )
+ }
+}
-// rs_bindings_from_cc/test/golden/clang_attrs.h;l=10
-// Error while generating bindings for item 'HasFieldWithCustomAlignment::HasFieldWithCustomAlignment':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl<'b> ctor::CtorNew<&'b crate::HasFieldWithCustomAlignment> for HasFieldWithCustomAlignment {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: &'b crate::HasFieldWithCustomAlignment) -> Self::CtorType {
+ let __param_0 = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN27HasFieldWithCustomAlignmentC1ERKS_(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ __param_0,
+ );
+ },
+ )
+ }
+}
+impl<'b> ctor::CtorNew<(&'b crate::HasFieldWithCustomAlignment,)> for HasFieldWithCustomAlignment {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: (&'b crate::HasFieldWithCustomAlignment,)) -> Self::CtorType {
+ let (arg,) = args;
+ <Self as ctor::CtorNew<&'b crate::HasFieldWithCustomAlignment>>::ctor_new(arg)
+ }
+}
-// rs_bindings_from_cc/test/golden/clang_attrs.h;l=10
-// Error while generating bindings for item 'HasFieldWithCustomAlignment::HasFieldWithCustomAlignment':
-// Parameter #0 is not supported: Unsupported type 'struct HasFieldWithCustomAlignment &&': Unsupported type: && without lifetime
+impl<'b> ctor::CtorNew<ctor::RvalueReference<'b, crate::HasFieldWithCustomAlignment>>
+ for HasFieldWithCustomAlignment
+{
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(
+ args: ctor::RvalueReference<'b, crate::HasFieldWithCustomAlignment>,
+ ) -> Self::CtorType {
+ let __param_0 = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN27HasFieldWithCustomAlignmentC1EOS_(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ __param_0,
+ );
+ },
+ )
+ }
+}
+impl<'b> ctor::CtorNew<(ctor::RvalueReference<'b, crate::HasFieldWithCustomAlignment>,)>
+ for HasFieldWithCustomAlignment
+{
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(
+ args: (ctor::RvalueReference<'b, crate::HasFieldWithCustomAlignment>,),
+ ) -> Self::CtorType {
+ let (arg,) = args;
+ <Self as ctor::CtorNew<ctor::RvalueReference<'b,crate::HasFieldWithCustomAlignment>>>::ctor_new(arg)
+ }
+}
-// rs_bindings_from_cc/test/golden/clang_attrs.h;l=10
+// rs_bindings_from_cc/test/golden/clang_attrs.h;l=12
// Error while generating bindings for item 'HasFieldWithCustomAlignment::operator=':
// Bindings for this kind of operator are not supported
-// rs_bindings_from_cc/test/golden/clang_attrs.h;l=10
+// rs_bindings_from_cc/test/golden/clang_attrs.h;l=12
// Error while generating bindings for item 'HasFieldWithCustomAlignment::operator=':
-// Parameter #0 is not supported: Unsupported type 'struct HasFieldWithCustomAlignment &&': Unsupported type: && without lifetime
+// Bindings for this kind of operator are not supported
#[ctor::recursively_pinned]
#[repr(C, align(64))]
@@ -87,25 +201,90 @@
crate::InheritsFromBaseWithCustomAlignment
);
-// rs_bindings_from_cc/test/golden/clang_attrs.h;l=14
-// Error while generating bindings for item 'InheritsFromBaseWithCustomAlignment::InheritsFromBaseWithCustomAlignment':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl ctor::CtorNew<()> for InheritsFromBaseWithCustomAlignment {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: ()) -> Self::CtorType {
+ let () = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN35InheritsFromBaseWithCustomAlignmentC1Ev(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ );
+ },
+ )
+ }
+}
-// rs_bindings_from_cc/test/golden/clang_attrs.h;l=14
-// Error while generating bindings for item 'InheritsFromBaseWithCustomAlignment::InheritsFromBaseWithCustomAlignment':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl<'b> ctor::CtorNew<&'b crate::InheritsFromBaseWithCustomAlignment>
+ for InheritsFromBaseWithCustomAlignment
+{
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: &'b crate::InheritsFromBaseWithCustomAlignment) -> Self::CtorType {
+ let __param_0 = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN35InheritsFromBaseWithCustomAlignmentC1ERKS_(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ __param_0,
+ );
+ },
+ )
+ }
+}
+impl<'b> ctor::CtorNew<(&'b crate::InheritsFromBaseWithCustomAlignment,)>
+ for InheritsFromBaseWithCustomAlignment
+{
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: (&'b crate::InheritsFromBaseWithCustomAlignment,)) -> Self::CtorType {
+ let (arg,) = args;
+ <Self as ctor::CtorNew<&'b crate::InheritsFromBaseWithCustomAlignment>>::ctor_new(arg)
+ }
+}
-// rs_bindings_from_cc/test/golden/clang_attrs.h;l=14
-// Error while generating bindings for item 'InheritsFromBaseWithCustomAlignment::InheritsFromBaseWithCustomAlignment':
-// Parameter #0 is not supported: Unsupported type 'struct InheritsFromBaseWithCustomAlignment &&': Unsupported type: && without lifetime
+impl<'b> ctor::CtorNew<ctor::RvalueReference<'b, crate::InheritsFromBaseWithCustomAlignment>>
+ for InheritsFromBaseWithCustomAlignment
+{
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(
+ args: ctor::RvalueReference<'b, crate::InheritsFromBaseWithCustomAlignment>,
+ ) -> Self::CtorType {
+ let __param_0 = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN35InheritsFromBaseWithCustomAlignmentC1EOS_(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ __param_0,
+ );
+ },
+ )
+ }
+}
+impl<'b> ctor::CtorNew<(ctor::RvalueReference<'b, crate::InheritsFromBaseWithCustomAlignment>,)>
+ for InheritsFromBaseWithCustomAlignment
+{
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(
+ args: (ctor::RvalueReference<'b, crate::InheritsFromBaseWithCustomAlignment>,),
+ ) -> Self::CtorType {
+ let (arg,) = args;
+ <Self as ctor::CtorNew<
+ ctor::RvalueReference<'b, crate::InheritsFromBaseWithCustomAlignment>,
+ >>::ctor_new(arg)
+ }
+}
-// rs_bindings_from_cc/test/golden/clang_attrs.h;l=14
+// rs_bindings_from_cc/test/golden/clang_attrs.h;l=16
// Error while generating bindings for item 'InheritsFromBaseWithCustomAlignment::operator=':
// Bindings for this kind of operator are not supported
-// rs_bindings_from_cc/test/golden/clang_attrs.h;l=14
+// rs_bindings_from_cc/test/golden/clang_attrs.h;l=16
// Error while generating bindings for item 'InheritsFromBaseWithCustomAlignment::operator=':
-// Parameter #0 is not supported: Unsupported type 'struct InheritsFromBaseWithCustomAlignment &&': Unsupported type: && without lifetime
+// Bindings for this kind of operator are not supported
unsafe impl oops::Inherits<crate::HasCustomAlignment> for InheritsFromBaseWithCustomAlignment {
unsafe fn upcast_ptr(derived: *const Self) -> *const crate::HasCustomAlignment {
@@ -123,28 +302,146 @@
crate::HasCustomAlignmentWithGnuAttr
);
-// rs_bindings_from_cc/test/golden/clang_attrs.h;l=16
-// Error while generating bindings for item 'HasCustomAlignmentWithGnuAttr::HasCustomAlignmentWithGnuAttr':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl ctor::CtorNew<()> for HasCustomAlignmentWithGnuAttr {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: ()) -> Self::CtorType {
+ let () = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN29HasCustomAlignmentWithGnuAttrC1Ev(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ );
+ },
+ )
+ }
+}
-// rs_bindings_from_cc/test/golden/clang_attrs.h;l=16
-// Error while generating bindings for item 'HasCustomAlignmentWithGnuAttr::HasCustomAlignmentWithGnuAttr':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl<'b> ctor::CtorNew<&'b crate::HasCustomAlignmentWithGnuAttr> for HasCustomAlignmentWithGnuAttr {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: &'b crate::HasCustomAlignmentWithGnuAttr) -> Self::CtorType {
+ let __param_0 = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN29HasCustomAlignmentWithGnuAttrC1ERKS_(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ __param_0,
+ );
+ },
+ )
+ }
+}
+impl<'b> ctor::CtorNew<(&'b crate::HasCustomAlignmentWithGnuAttr,)>
+ for HasCustomAlignmentWithGnuAttr
+{
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: (&'b crate::HasCustomAlignmentWithGnuAttr,)) -> Self::CtorType {
+ let (arg,) = args;
+ <Self as ctor::CtorNew<&'b crate::HasCustomAlignmentWithGnuAttr>>::ctor_new(arg)
+ }
+}
-// rs_bindings_from_cc/test/golden/clang_attrs.h;l=16
-// Error while generating bindings for item 'HasCustomAlignmentWithGnuAttr::HasCustomAlignmentWithGnuAttr':
-// Parameter #0 is not supported: Unsupported type 'struct HasCustomAlignmentWithGnuAttr &&': Unsupported type: && without lifetime
+impl<'b> ctor::CtorNew<ctor::RvalueReference<'b, crate::HasCustomAlignmentWithGnuAttr>>
+ for HasCustomAlignmentWithGnuAttr
+{
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(
+ args: ctor::RvalueReference<'b, crate::HasCustomAlignmentWithGnuAttr>,
+ ) -> Self::CtorType {
+ let __param_0 = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN29HasCustomAlignmentWithGnuAttrC1EOS_(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ __param_0,
+ );
+ },
+ )
+ }
+}
+impl<'b> ctor::CtorNew<(ctor::RvalueReference<'b, crate::HasCustomAlignmentWithGnuAttr>,)>
+ for HasCustomAlignmentWithGnuAttr
+{
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(
+ args: (ctor::RvalueReference<'b, crate::HasCustomAlignmentWithGnuAttr>,),
+ ) -> Self::CtorType {
+ let (arg,) = args;
+ <Self as ctor::CtorNew<ctor::RvalueReference<'b,crate::HasCustomAlignmentWithGnuAttr>>>::ctor_new(arg)
+ }
+}
-// rs_bindings_from_cc/test/golden/clang_attrs.h;l=16
+// rs_bindings_from_cc/test/golden/clang_attrs.h;l=18
// Error while generating bindings for item 'HasCustomAlignmentWithGnuAttr::operator=':
// Bindings for this kind of operator are not supported
-// rs_bindings_from_cc/test/golden/clang_attrs.h;l=16
+// rs_bindings_from_cc/test/golden/clang_attrs.h;l=18
// Error while generating bindings for item 'HasCustomAlignmentWithGnuAttr::operator=':
-// Parameter #0 is not supported: Unsupported type 'struct HasCustomAlignmentWithGnuAttr &&': Unsupported type: && without lifetime
+// Bindings for this kind of operator are not supported
// CRUBIT_RS_BINDINGS_FROM_CC_TEST_GOLDEN_CLANG_ATTRS_H_
+mod detail {
+ #[allow(unused_imports)]
+ use super::*;
+ extern "C" {
+ pub(crate) fn __rust_thunk___ZN18HasCustomAlignmentC1Ev<'a>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::HasCustomAlignment>,
+ );
+ pub(crate) fn __rust_thunk___ZN18HasCustomAlignmentC1ERKS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::HasCustomAlignment>,
+ __param_0: &'b crate::HasCustomAlignment,
+ );
+ pub(crate) fn __rust_thunk___ZN18HasCustomAlignmentC1EOS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::HasCustomAlignment>,
+ __param_0: ctor::RvalueReference<'b, crate::HasCustomAlignment>,
+ );
+ pub(crate) fn __rust_thunk___ZN27HasFieldWithCustomAlignmentC1Ev<'a>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::HasFieldWithCustomAlignment>,
+ );
+ pub(crate) fn __rust_thunk___ZN27HasFieldWithCustomAlignmentC1ERKS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::HasFieldWithCustomAlignment>,
+ __param_0: &'b crate::HasFieldWithCustomAlignment,
+ );
+ pub(crate) fn __rust_thunk___ZN27HasFieldWithCustomAlignmentC1EOS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::HasFieldWithCustomAlignment>,
+ __param_0: ctor::RvalueReference<'b, crate::HasFieldWithCustomAlignment>,
+ );
+ pub(crate) fn __rust_thunk___ZN35InheritsFromBaseWithCustomAlignmentC1Ev<'a>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<
+ crate::InheritsFromBaseWithCustomAlignment,
+ >,
+ );
+ pub(crate) fn __rust_thunk___ZN35InheritsFromBaseWithCustomAlignmentC1ERKS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<
+ crate::InheritsFromBaseWithCustomAlignment,
+ >,
+ __param_0: &'b crate::InheritsFromBaseWithCustomAlignment,
+ );
+ pub(crate) fn __rust_thunk___ZN35InheritsFromBaseWithCustomAlignmentC1EOS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<
+ crate::InheritsFromBaseWithCustomAlignment,
+ >,
+ __param_0: ctor::RvalueReference<'b, crate::InheritsFromBaseWithCustomAlignment>,
+ );
+ pub(crate) fn __rust_thunk___ZN29HasCustomAlignmentWithGnuAttrC1Ev<'a>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::HasCustomAlignmentWithGnuAttr>,
+ );
+ pub(crate) fn __rust_thunk___ZN29HasCustomAlignmentWithGnuAttrC1ERKS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::HasCustomAlignmentWithGnuAttr>,
+ __param_0: &'b crate::HasCustomAlignmentWithGnuAttr,
+ );
+ pub(crate) fn __rust_thunk___ZN29HasCustomAlignmentWithGnuAttrC1EOS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::HasCustomAlignmentWithGnuAttr>,
+ __param_0: ctor::RvalueReference<'b, crate::HasCustomAlignmentWithGnuAttr>,
+ );
+ }
+}
+
const _: () = assert!(rust_std::mem::size_of::<Option<&i32>>() == rust_std::mem::size_of::<&i32>());
const _: () = assert!(rust_std::mem::size_of::<crate::HasCustomAlignment>() == 64);
diff --git a/rs_bindings_from_cc/test/golden/clang_attrs_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/clang_attrs_rs_api_impl.cc
index 3c027dd..a32fbb8 100644
--- a/rs_bindings_from_cc/test/golden/clang_attrs_rs_api_impl.cc
+++ b/rs_bindings_from_cc/test/golden/clang_attrs_rs_api_impl.cc
@@ -21,6 +21,11 @@
crubit::construct_at(std::forward<decltype(__this)>(__this),
std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" void __rust_thunk___ZN18HasCustomAlignmentC1EOS_(
+ class HasCustomAlignment* __this, class HasCustomAlignment&& __param_0) {
+ crubit::construct_at(std::forward<decltype(__this)>(__this),
+ std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN18HasCustomAlignmentD1Ev(
class HasCustomAlignment* __this) {
std::destroy_at(std::forward<decltype(__this)>(__this));
@@ -31,6 +36,11 @@
const class HasCustomAlignment& __param_0) {
return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" class HasCustomAlignment&
+__rust_thunk___ZN18HasCustomAlignmentaSEOS_(
+ class HasCustomAlignment* __this, class HasCustomAlignment&& __param_0) {
+ return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN27HasFieldWithCustomAlignmentC1Ev(
class HasFieldWithCustomAlignment* __this) {
crubit::construct_at(std::forward<decltype(__this)>(__this));
@@ -41,6 +51,12 @@
crubit::construct_at(std::forward<decltype(__this)>(__this),
std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" void __rust_thunk___ZN27HasFieldWithCustomAlignmentC1EOS_(
+ class HasFieldWithCustomAlignment* __this,
+ class HasFieldWithCustomAlignment&& __param_0) {
+ crubit::construct_at(std::forward<decltype(__this)>(__this),
+ std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN27HasFieldWithCustomAlignmentD1Ev(
class HasFieldWithCustomAlignment* __this) {
std::destroy_at(std::forward<decltype(__this)>(__this));
@@ -51,6 +67,12 @@
const class HasFieldWithCustomAlignment& __param_0) {
return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" class HasFieldWithCustomAlignment&
+__rust_thunk___ZN27HasFieldWithCustomAlignmentaSEOS_(
+ class HasFieldWithCustomAlignment* __this,
+ class HasFieldWithCustomAlignment&& __param_0) {
+ return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN35InheritsFromBaseWithCustomAlignmentC1Ev(
class InheritsFromBaseWithCustomAlignment* __this) {
crubit::construct_at(std::forward<decltype(__this)>(__this));
@@ -61,6 +83,12 @@
crubit::construct_at(std::forward<decltype(__this)>(__this),
std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" void __rust_thunk___ZN35InheritsFromBaseWithCustomAlignmentC1EOS_(
+ class InheritsFromBaseWithCustomAlignment* __this,
+ class InheritsFromBaseWithCustomAlignment&& __param_0) {
+ crubit::construct_at(std::forward<decltype(__this)>(__this),
+ std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN35InheritsFromBaseWithCustomAlignmentD1Ev(
class InheritsFromBaseWithCustomAlignment* __this) {
std::destroy_at(std::forward<decltype(__this)>(__this));
@@ -71,6 +99,12 @@
const class InheritsFromBaseWithCustomAlignment& __param_0) {
return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" class InheritsFromBaseWithCustomAlignment&
+__rust_thunk___ZN35InheritsFromBaseWithCustomAlignmentaSEOS_(
+ class InheritsFromBaseWithCustomAlignment* __this,
+ class InheritsFromBaseWithCustomAlignment&& __param_0) {
+ return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN29HasCustomAlignmentWithGnuAttrC1Ev(
class HasCustomAlignmentWithGnuAttr* __this) {
crubit::construct_at(std::forward<decltype(__this)>(__this));
@@ -81,6 +115,12 @@
crubit::construct_at(std::forward<decltype(__this)>(__this),
std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" void __rust_thunk___ZN29HasCustomAlignmentWithGnuAttrC1EOS_(
+ class HasCustomAlignmentWithGnuAttr* __this,
+ class HasCustomAlignmentWithGnuAttr&& __param_0) {
+ crubit::construct_at(std::forward<decltype(__this)>(__this),
+ std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN29HasCustomAlignmentWithGnuAttrD1Ev(
class HasCustomAlignmentWithGnuAttr* __this) {
std::destroy_at(std::forward<decltype(__this)>(__this));
@@ -91,6 +131,12 @@
const class HasCustomAlignmentWithGnuAttr& __param_0) {
return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" class HasCustomAlignmentWithGnuAttr&
+__rust_thunk___ZN29HasCustomAlignmentWithGnuAttraSEOS_(
+ class HasCustomAlignmentWithGnuAttr* __this,
+ class HasCustomAlignmentWithGnuAttr&& __param_0) {
+ return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
+}
static_assert(sizeof(class HasCustomAlignment) == 64);
static_assert(alignof(class HasCustomAlignment) == 64);
diff --git a/rs_bindings_from_cc/test/golden/inheritance.h b/rs_bindings_from_cc/test/golden/inheritance.h
index 7b7c70e..259ce94 100644
--- a/rs_bindings_from_cc/test/golden/inheritance.h
+++ b/rs_bindings_from_cc/test/golden/inheritance.h
@@ -6,6 +6,8 @@
#define CRUBIT_RS_BINDINGS_FROM_CC_TEST_GOLDEN_INHERITANCE_H_
#include <stdint.h>
+#pragma clang lifetime_elision
+
// Using classes to force these to be non-POD.
// In the Itanium ABI, the tail padding of POD types cannot be reused by other
// objects, even if the POD type is potentially-overlapping.
diff --git a/rs_bindings_from_cc/test/golden/inheritance_rs_api.rs b/rs_bindings_from_cc/test/golden/inheritance_rs_api.rs
index 2fa4549..7482626 100644
--- a/rs_bindings_from_cc/test/golden/inheritance_rs_api.rs
+++ b/rs_bindings_from_cc/test/golden/inheritance_rs_api.rs
@@ -5,7 +5,7 @@
// Automatically @generated Rust bindings for C++ target
// //rs_bindings_from_cc/test/golden:inheritance_cc
#![rustfmt::skip]
-#![feature(const_ptr_offset_from, custom_inner_attributes, negative_impls)]
+#![feature(const_ptr_offset_from, custom_inner_attributes, negative_impls, type_alias_impl_trait)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
@@ -27,25 +27,76 @@
}
forward_declare::unsafe_define!(forward_declare::symbol!("Base0"), crate::Base0);
-// rs_bindings_from_cc/test/golden/inheritance.h;l=13
-// Error while generating bindings for item 'Base0::Base0':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl ctor::CtorNew<()> for Base0 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: ()) -> Self::CtorType {
+ let () = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN5Base0C1Ev(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ );
+ },
+ )
+ }
+}
-// rs_bindings_from_cc/test/golden/inheritance.h;l=13
-// Error while generating bindings for item 'Base0::Base0':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl<'b> ctor::CtorNew<&'b crate::Base0> for Base0 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: &'b crate::Base0) -> Self::CtorType {
+ let __param_0 = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN5Base0C1ERKS_(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ __param_0,
+ );
+ },
+ )
+ }
+}
+impl<'b> ctor::CtorNew<(&'b crate::Base0,)> for Base0 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: (&'b crate::Base0,)) -> Self::CtorType {
+ let (arg,) = args;
+ <Self as ctor::CtorNew<&'b crate::Base0>>::ctor_new(arg)
+ }
+}
-// rs_bindings_from_cc/test/golden/inheritance.h;l=13
-// Error while generating bindings for item 'Base0::Base0':
-// Parameter #0 is not supported: Unsupported type 'class Base0 &&': Unsupported type: && without lifetime
+impl<'b> ctor::CtorNew<ctor::RvalueReference<'b, crate::Base0>> for Base0 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: ctor::RvalueReference<'b, crate::Base0>) -> Self::CtorType {
+ let __param_0 = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN5Base0C1EOS_(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ __param_0,
+ );
+ },
+ )
+ }
+}
+impl<'b> ctor::CtorNew<(ctor::RvalueReference<'b, crate::Base0>,)> for Base0 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: (ctor::RvalueReference<'b, crate::Base0>,)) -> Self::CtorType {
+ let (arg,) = args;
+ <Self as ctor::CtorNew<ctor::RvalueReference<'b, crate::Base0>>>::ctor_new(arg)
+ }
+}
-// rs_bindings_from_cc/test/golden/inheritance.h;l=13
+// rs_bindings_from_cc/test/golden/inheritance.h;l=15
// Error while generating bindings for item 'Base0::operator=':
// Bindings for this kind of operator are not supported
-// rs_bindings_from_cc/test/golden/inheritance.h;l=13
+// rs_bindings_from_cc/test/golden/inheritance.h;l=15
// Error while generating bindings for item 'Base0::operator=':
-// Parameter #0 is not supported: Unsupported type 'class Base0 &&': Unsupported type: && without lifetime
+// Bindings for this kind of operator are not supported
#[ctor::recursively_pinned]
#[repr(C, align(8))]
@@ -60,25 +111,76 @@
}
forward_declare::unsafe_define!(forward_declare::symbol!("Base1"), crate::Base1);
-// rs_bindings_from_cc/test/golden/inheritance.h;l=14
-// Error while generating bindings for item 'Base1::Base1':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl ctor::CtorNew<()> for Base1 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: ()) -> Self::CtorType {
+ let () = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN5Base1C1Ev(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ );
+ },
+ )
+ }
+}
-// rs_bindings_from_cc/test/golden/inheritance.h;l=14
-// Error while generating bindings for item 'Base1::Base1':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl<'b> ctor::CtorNew<&'b crate::Base1> for Base1 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: &'b crate::Base1) -> Self::CtorType {
+ let __param_0 = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN5Base1C1ERKS_(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ __param_0,
+ );
+ },
+ )
+ }
+}
+impl<'b> ctor::CtorNew<(&'b crate::Base1,)> for Base1 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: (&'b crate::Base1,)) -> Self::CtorType {
+ let (arg,) = args;
+ <Self as ctor::CtorNew<&'b crate::Base1>>::ctor_new(arg)
+ }
+}
-// rs_bindings_from_cc/test/golden/inheritance.h;l=14
-// Error while generating bindings for item 'Base1::Base1':
-// Parameter #0 is not supported: Unsupported type 'class Base1 &&': Unsupported type: && without lifetime
+impl<'b> ctor::CtorNew<ctor::RvalueReference<'b, crate::Base1>> for Base1 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: ctor::RvalueReference<'b, crate::Base1>) -> Self::CtorType {
+ let __param_0 = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN5Base1C1EOS_(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ __param_0,
+ );
+ },
+ )
+ }
+}
+impl<'b> ctor::CtorNew<(ctor::RvalueReference<'b, crate::Base1>,)> for Base1 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: (ctor::RvalueReference<'b, crate::Base1>,)) -> Self::CtorType {
+ let (arg,) = args;
+ <Self as ctor::CtorNew<ctor::RvalueReference<'b, crate::Base1>>>::ctor_new(arg)
+ }
+}
-// rs_bindings_from_cc/test/golden/inheritance.h;l=14
+// rs_bindings_from_cc/test/golden/inheritance.h;l=16
// Error while generating bindings for item 'Base1::operator=':
// Bindings for this kind of operator are not supported
-// rs_bindings_from_cc/test/golden/inheritance.h;l=14
+// rs_bindings_from_cc/test/golden/inheritance.h;l=16
// Error while generating bindings for item 'Base1::operator=':
-// Parameter #0 is not supported: Unsupported type 'class Base1 &&': Unsupported type: && without lifetime
+// Bindings for this kind of operator are not supported
#[ctor::recursively_pinned]
#[repr(C, align(2))]
@@ -90,25 +192,76 @@
}
forward_declare::unsafe_define!(forward_declare::symbol!("Base2"), crate::Base2);
-// rs_bindings_from_cc/test/golden/inheritance.h;l=19
-// Error while generating bindings for item 'Base2::Base2':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl ctor::CtorNew<()> for Base2 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: ()) -> Self::CtorType {
+ let () = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN5Base2C1Ev(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ );
+ },
+ )
+ }
+}
-// rs_bindings_from_cc/test/golden/inheritance.h;l=19
-// Error while generating bindings for item 'Base2::Base2':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl<'b> ctor::CtorNew<&'b crate::Base2> for Base2 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: &'b crate::Base2) -> Self::CtorType {
+ let __param_0 = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN5Base2C1ERKS_(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ __param_0,
+ );
+ },
+ )
+ }
+}
+impl<'b> ctor::CtorNew<(&'b crate::Base2,)> for Base2 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: (&'b crate::Base2,)) -> Self::CtorType {
+ let (arg,) = args;
+ <Self as ctor::CtorNew<&'b crate::Base2>>::ctor_new(arg)
+ }
+}
-// rs_bindings_from_cc/test/golden/inheritance.h;l=19
-// Error while generating bindings for item 'Base2::Base2':
-// Parameter #0 is not supported: Unsupported type 'class Base2 &&': Unsupported type: && without lifetime
+impl<'b> ctor::CtorNew<ctor::RvalueReference<'b, crate::Base2>> for Base2 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: ctor::RvalueReference<'b, crate::Base2>) -> Self::CtorType {
+ let __param_0 = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN5Base2C1EOS_(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ __param_0,
+ );
+ },
+ )
+ }
+}
+impl<'b> ctor::CtorNew<(ctor::RvalueReference<'b, crate::Base2>,)> for Base2 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: (ctor::RvalueReference<'b, crate::Base2>,)) -> Self::CtorType {
+ let (arg,) = args;
+ <Self as ctor::CtorNew<ctor::RvalueReference<'b, crate::Base2>>>::ctor_new(arg)
+ }
+}
-// rs_bindings_from_cc/test/golden/inheritance.h;l=19
+// rs_bindings_from_cc/test/golden/inheritance.h;l=21
// Error while generating bindings for item 'Base2::operator=':
// Bindings for this kind of operator are not supported
-// rs_bindings_from_cc/test/golden/inheritance.h;l=19
+// rs_bindings_from_cc/test/golden/inheritance.h;l=21
// Error while generating bindings for item 'Base2::operator=':
-// Parameter #0 is not supported: Unsupported type 'class Base2 &&': Unsupported type: && without lifetime
+// Bindings for this kind of operator are not supported
#[derive(Clone, Copy)]
#[repr(C, align(8))]
@@ -118,25 +271,35 @@
}
forward_declare::unsafe_define!(forward_declare::symbol!("Derived"), crate::Derived);
-// rs_bindings_from_cc/test/golden/inheritance.h;l=23
-// Error while generating bindings for item 'Derived::Derived':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl Default for Derived {
+ #[inline(always)]
+ fn default() -> Self {
+ let mut tmp = crate::rust_std::mem::MaybeUninit::<Self>::zeroed();
+ unsafe {
+ crate::detail::__rust_thunk___ZN7DerivedC1Ev(&mut tmp);
+ tmp.assume_init()
+ }
+ }
+}
-// rs_bindings_from_cc/test/golden/inheritance.h;l=23
-// Error while generating bindings for item 'Derived::Derived':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl<'b> From<ctor::RvalueReference<'b, crate::Derived>> for Derived {
+ #[inline(always)]
+ fn from(__param_0: ctor::RvalueReference<'b, crate::Derived>) -> Self {
+ let mut tmp = crate::rust_std::mem::MaybeUninit::<Self>::zeroed();
+ unsafe {
+ crate::detail::__rust_thunk___ZN7DerivedC1EOS_(&mut tmp, __param_0);
+ tmp.assume_init()
+ }
+ }
+}
-// rs_bindings_from_cc/test/golden/inheritance.h;l=23
-// Error while generating bindings for item 'Derived::Derived':
-// Parameter #0 is not supported: Unsupported type 'struct Derived &&': Unsupported type: && without lifetime
-
-// rs_bindings_from_cc/test/golden/inheritance.h;l=23
+// rs_bindings_from_cc/test/golden/inheritance.h;l=25
// Error while generating bindings for item 'Derived::operator=':
// Bindings for this kind of operator are not supported
-// rs_bindings_from_cc/test/golden/inheritance.h;l=23
+// rs_bindings_from_cc/test/golden/inheritance.h;l=25
// Error while generating bindings for item 'Derived::operator=':
-// Parameter #0 is not supported: Unsupported type 'struct Derived &&': Unsupported type: && without lifetime
+// Bindings for this kind of operator are not supported
unsafe impl oops::Inherits<crate::Base0> for Derived {
unsafe fn upcast_ptr(derived: *const Self) -> *const crate::Base0 {
@@ -161,25 +324,76 @@
}
forward_declare::unsafe_define!(forward_declare::symbol!("VirtualBase1"), crate::VirtualBase1);
-// rs_bindings_from_cc/test/golden/inheritance.h;l=27
-// Error while generating bindings for item 'VirtualBase1::VirtualBase1':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl ctor::CtorNew<()> for VirtualBase1 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: ()) -> Self::CtorType {
+ let () = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN12VirtualBase1C1Ev(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ );
+ },
+ )
+ }
+}
-// rs_bindings_from_cc/test/golden/inheritance.h;l=27
-// Error while generating bindings for item 'VirtualBase1::VirtualBase1':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl<'b> ctor::CtorNew<&'b crate::VirtualBase1> for VirtualBase1 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: &'b crate::VirtualBase1) -> Self::CtorType {
+ let __param_0 = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN12VirtualBase1C1ERKS_(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ __param_0,
+ );
+ },
+ )
+ }
+}
+impl<'b> ctor::CtorNew<(&'b crate::VirtualBase1,)> for VirtualBase1 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: (&'b crate::VirtualBase1,)) -> Self::CtorType {
+ let (arg,) = args;
+ <Self as ctor::CtorNew<&'b crate::VirtualBase1>>::ctor_new(arg)
+ }
+}
-// rs_bindings_from_cc/test/golden/inheritance.h;l=27
-// Error while generating bindings for item 'VirtualBase1::VirtualBase1':
-// Parameter #0 is not supported: Unsupported type 'class VirtualBase1 &&': Unsupported type: && without lifetime
+impl<'b> ctor::CtorNew<ctor::RvalueReference<'b, crate::VirtualBase1>> for VirtualBase1 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: ctor::RvalueReference<'b, crate::VirtualBase1>) -> Self::CtorType {
+ let __param_0 = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN12VirtualBase1C1EOS_(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ __param_0,
+ );
+ },
+ )
+ }
+}
+impl<'b> ctor::CtorNew<(ctor::RvalueReference<'b, crate::VirtualBase1>,)> for VirtualBase1 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: (ctor::RvalueReference<'b, crate::VirtualBase1>,)) -> Self::CtorType {
+ let (arg,) = args;
+ <Self as ctor::CtorNew<ctor::RvalueReference<'b, crate::VirtualBase1>>>::ctor_new(arg)
+ }
+}
-// rs_bindings_from_cc/test/golden/inheritance.h;l=27
+// rs_bindings_from_cc/test/golden/inheritance.h;l=29
// Error while generating bindings for item 'VirtualBase1::operator=':
// Bindings for this kind of operator are not supported
-// rs_bindings_from_cc/test/golden/inheritance.h;l=27
+// rs_bindings_from_cc/test/golden/inheritance.h;l=29
// Error while generating bindings for item 'VirtualBase1::operator=':
-// Parameter #0 is not supported: Unsupported type 'class VirtualBase1 &&': Unsupported type: && without lifetime
+// Bindings for this kind of operator are not supported
unsafe impl oops::Inherits<crate::Base1> for VirtualBase1 {
unsafe fn upcast_ptr(derived: *const Self) -> *const crate::Base1 {
@@ -194,25 +408,76 @@
}
forward_declare::unsafe_define!(forward_declare::symbol!("VirtualBase2"), crate::VirtualBase2);
-// rs_bindings_from_cc/test/golden/inheritance.h;l=28
-// Error while generating bindings for item 'VirtualBase2::VirtualBase2':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl ctor::CtorNew<()> for VirtualBase2 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: ()) -> Self::CtorType {
+ let () = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN12VirtualBase2C1Ev(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ );
+ },
+ )
+ }
+}
-// rs_bindings_from_cc/test/golden/inheritance.h;l=28
-// Error while generating bindings for item 'VirtualBase2::VirtualBase2':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl<'b> ctor::CtorNew<&'b crate::VirtualBase2> for VirtualBase2 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: &'b crate::VirtualBase2) -> Self::CtorType {
+ let __param_0 = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN12VirtualBase2C1ERKS_(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ __param_0,
+ );
+ },
+ )
+ }
+}
+impl<'b> ctor::CtorNew<(&'b crate::VirtualBase2,)> for VirtualBase2 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: (&'b crate::VirtualBase2,)) -> Self::CtorType {
+ let (arg,) = args;
+ <Self as ctor::CtorNew<&'b crate::VirtualBase2>>::ctor_new(arg)
+ }
+}
-// rs_bindings_from_cc/test/golden/inheritance.h;l=28
-// Error while generating bindings for item 'VirtualBase2::VirtualBase2':
-// Parameter #0 is not supported: Unsupported type 'class VirtualBase2 &&': Unsupported type: && without lifetime
+impl<'b> ctor::CtorNew<ctor::RvalueReference<'b, crate::VirtualBase2>> for VirtualBase2 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: ctor::RvalueReference<'b, crate::VirtualBase2>) -> Self::CtorType {
+ let __param_0 = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN12VirtualBase2C1EOS_(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ __param_0,
+ );
+ },
+ )
+ }
+}
+impl<'b> ctor::CtorNew<(ctor::RvalueReference<'b, crate::VirtualBase2>,)> for VirtualBase2 {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: (ctor::RvalueReference<'b, crate::VirtualBase2>,)) -> Self::CtorType {
+ let (arg,) = args;
+ <Self as ctor::CtorNew<ctor::RvalueReference<'b, crate::VirtualBase2>>>::ctor_new(arg)
+ }
+}
-// rs_bindings_from_cc/test/golden/inheritance.h;l=28
+// rs_bindings_from_cc/test/golden/inheritance.h;l=30
// Error while generating bindings for item 'VirtualBase2::operator=':
// Bindings for this kind of operator are not supported
-// rs_bindings_from_cc/test/golden/inheritance.h;l=28
+// rs_bindings_from_cc/test/golden/inheritance.h;l=30
// Error while generating bindings for item 'VirtualBase2::operator=':
-// Parameter #0 is not supported: Unsupported type 'class VirtualBase2 &&': Unsupported type: && without lifetime
+// Bindings for this kind of operator are not supported
unsafe impl oops::Inherits<crate::Base1> for VirtualBase2 {
unsafe fn upcast_ptr(derived: *const Self) -> *const crate::Base1 {
@@ -227,25 +492,76 @@
}
forward_declare::unsafe_define!(forward_declare::symbol!("VirtualDerived"), crate::VirtualDerived);
-// rs_bindings_from_cc/test/golden/inheritance.h;l=29
-// Error while generating bindings for item 'VirtualDerived::VirtualDerived':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl ctor::CtorNew<()> for VirtualDerived {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: ()) -> Self::CtorType {
+ let () = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN14VirtualDerivedC1Ev(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ );
+ },
+ )
+ }
+}
-// rs_bindings_from_cc/test/golden/inheritance.h;l=29
-// Error while generating bindings for item 'VirtualDerived::VirtualDerived':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl<'b> ctor::CtorNew<&'b crate::VirtualDerived> for VirtualDerived {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: &'b crate::VirtualDerived) -> Self::CtorType {
+ let __param_0 = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN14VirtualDerivedC1ERKS_(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ __param_0,
+ );
+ },
+ )
+ }
+}
+impl<'b> ctor::CtorNew<(&'b crate::VirtualDerived,)> for VirtualDerived {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: (&'b crate::VirtualDerived,)) -> Self::CtorType {
+ let (arg,) = args;
+ <Self as ctor::CtorNew<&'b crate::VirtualDerived>>::ctor_new(arg)
+ }
+}
-// rs_bindings_from_cc/test/golden/inheritance.h;l=29
-// Error while generating bindings for item 'VirtualDerived::VirtualDerived':
-// Parameter #0 is not supported: Unsupported type 'class VirtualDerived &&': Unsupported type: && without lifetime
+impl<'b> ctor::CtorNew<ctor::RvalueReference<'b, crate::VirtualDerived>> for VirtualDerived {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: ctor::RvalueReference<'b, crate::VirtualDerived>) -> Self::CtorType {
+ let __param_0 = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN14VirtualDerivedC1EOS_(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ __param_0,
+ );
+ },
+ )
+ }
+}
+impl<'b> ctor::CtorNew<(ctor::RvalueReference<'b, crate::VirtualDerived>,)> for VirtualDerived {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: (ctor::RvalueReference<'b, crate::VirtualDerived>,)) -> Self::CtorType {
+ let (arg,) = args;
+ <Self as ctor::CtorNew<ctor::RvalueReference<'b, crate::VirtualDerived>>>::ctor_new(arg)
+ }
+}
-// rs_bindings_from_cc/test/golden/inheritance.h;l=29
+// rs_bindings_from_cc/test/golden/inheritance.h;l=31
// Error while generating bindings for item 'VirtualDerived::operator=':
// Bindings for this kind of operator are not supported
-// rs_bindings_from_cc/test/golden/inheritance.h;l=29
+// rs_bindings_from_cc/test/golden/inheritance.h;l=31
// Error while generating bindings for item 'VirtualDerived::operator=':
-// Parameter #0 is not supported: Unsupported type 'class VirtualDerived &&': Unsupported type: && without lifetime
+// Bindings for this kind of operator are not supported
unsafe impl oops::Inherits<crate::VirtualBase1> for VirtualDerived {
unsafe fn upcast_ptr(derived: *const Self) -> *const crate::VirtualBase1 {
@@ -263,7 +579,7 @@
}
}
-// rs_bindings_from_cc/test/golden/inheritance.h;l=32
+// rs_bindings_from_cc/test/golden/inheritance.h;l=34
// Error while generating bindings for item 'MyAbstractClass':
// Abstract classes are not supported yet
@@ -273,12 +589,85 @@
#[allow(unused_imports)]
use super::*;
extern "C" {
+ pub(crate) fn __rust_thunk___ZN5Base0C1Ev<'a>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::Base0>,
+ );
+ pub(crate) fn __rust_thunk___ZN5Base0C1ERKS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::Base0>,
+ __param_0: &'b crate::Base0,
+ );
+ pub(crate) fn __rust_thunk___ZN5Base0C1EOS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::Base0>,
+ __param_0: ctor::RvalueReference<'b, crate::Base0>,
+ );
+ pub(crate) fn __rust_thunk___ZN5Base1C1Ev<'a>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::Base1>,
+ );
+ pub(crate) fn __rust_thunk___ZN5Base1C1ERKS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::Base1>,
+ __param_0: &'b crate::Base1,
+ );
+ pub(crate) fn __rust_thunk___ZN5Base1C1EOS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::Base1>,
+ __param_0: ctor::RvalueReference<'b, crate::Base1>,
+ );
+ pub(crate) fn __rust_thunk___ZN5Base2C1Ev<'a>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::Base2>,
+ );
+ pub(crate) fn __rust_thunk___ZN5Base2C1ERKS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::Base2>,
+ __param_0: &'b crate::Base2,
+ );
+ pub(crate) fn __rust_thunk___ZN5Base2C1EOS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::Base2>,
+ __param_0: ctor::RvalueReference<'b, crate::Base2>,
+ );
+ pub(crate) fn __rust_thunk___ZN7DerivedC1Ev<'a>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::Derived>,
+ );
+ pub(crate) fn __rust_thunk___ZN7DerivedC1EOS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::Derived>,
+ __param_0: ctor::RvalueReference<'b, crate::Derived>,
+ );
+ pub(crate) fn __rust_thunk___ZN12VirtualBase1C1Ev<'a>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::VirtualBase1>,
+ );
+ pub(crate) fn __rust_thunk___ZN12VirtualBase1C1ERKS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::VirtualBase1>,
+ __param_0: &'b crate::VirtualBase1,
+ );
+ pub(crate) fn __rust_thunk___ZN12VirtualBase1C1EOS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::VirtualBase1>,
+ __param_0: ctor::RvalueReference<'b, crate::VirtualBase1>,
+ );
pub fn __crubit_dynamic_upcast__VirtualBase1__to__Base1(
from: *const VirtualBase1,
) -> *const crate::Base1;
+ pub(crate) fn __rust_thunk___ZN12VirtualBase2C1Ev<'a>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::VirtualBase2>,
+ );
+ pub(crate) fn __rust_thunk___ZN12VirtualBase2C1ERKS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::VirtualBase2>,
+ __param_0: &'b crate::VirtualBase2,
+ );
+ pub(crate) fn __rust_thunk___ZN12VirtualBase2C1EOS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::VirtualBase2>,
+ __param_0: ctor::RvalueReference<'b, crate::VirtualBase2>,
+ );
pub fn __crubit_dynamic_upcast__VirtualBase2__to__Base1(
from: *const VirtualBase2,
) -> *const crate::Base1;
+ pub(crate) fn __rust_thunk___ZN14VirtualDerivedC1Ev<'a>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::VirtualDerived>,
+ );
+ pub(crate) fn __rust_thunk___ZN14VirtualDerivedC1ERKS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::VirtualDerived>,
+ __param_0: &'b crate::VirtualDerived,
+ );
+ pub(crate) fn __rust_thunk___ZN14VirtualDerivedC1EOS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::VirtualDerived>,
+ __param_0: ctor::RvalueReference<'b, crate::VirtualDerived>,
+ );
pub fn __crubit_dynamic_upcast__VirtualDerived__to__VirtualBase1(
from: *const VirtualDerived,
) -> *const crate::VirtualBase1;
diff --git a/rs_bindings_from_cc/test/golden/inheritance_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/inheritance_rs_api_impl.cc
index 2fb4c58..4ea50a1 100644
--- a/rs_bindings_from_cc/test/golden/inheritance_rs_api_impl.cc
+++ b/rs_bindings_from_cc/test/golden/inheritance_rs_api_impl.cc
@@ -19,6 +19,11 @@
crubit::construct_at(std::forward<decltype(__this)>(__this),
std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" void __rust_thunk___ZN5Base0C1EOS_(class Base0* __this,
+ class Base0&& __param_0) {
+ crubit::construct_at(std::forward<decltype(__this)>(__this),
+ std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN5Base0D1Ev(class Base0* __this) {
std::destroy_at(std::forward<decltype(__this)>(__this));
}
@@ -26,6 +31,10 @@
class Base0* __this, const class Base0& __param_0) {
return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" class Base0& __rust_thunk___ZN5Base0aSEOS_(class Base0* __this,
+ class Base0&& __param_0) {
+ return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN5Base1C1Ev(class Base1* __this) {
crubit::construct_at(std::forward<decltype(__this)>(__this));
}
@@ -34,6 +43,11 @@
crubit::construct_at(std::forward<decltype(__this)>(__this),
std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" void __rust_thunk___ZN5Base1C1EOS_(class Base1* __this,
+ class Base1&& __param_0) {
+ crubit::construct_at(std::forward<decltype(__this)>(__this),
+ std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN5Base1D1Ev(class Base1* __this) {
std::destroy_at(std::forward<decltype(__this)>(__this));
}
@@ -41,6 +55,10 @@
class Base1* __this, const class Base1& __param_0) {
return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" class Base1& __rust_thunk___ZN5Base1aSEOS_(class Base1* __this,
+ class Base1&& __param_0) {
+ return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN5Base2C1Ev(class Base2* __this) {
crubit::construct_at(std::forward<decltype(__this)>(__this));
}
@@ -49,6 +67,11 @@
crubit::construct_at(std::forward<decltype(__this)>(__this),
std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" void __rust_thunk___ZN5Base2C1EOS_(class Base2* __this,
+ class Base2&& __param_0) {
+ crubit::construct_at(std::forward<decltype(__this)>(__this),
+ std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN5Base2D1Ev(class Base2* __this) {
std::destroy_at(std::forward<decltype(__this)>(__this));
}
@@ -56,6 +79,10 @@
class Base2* __this, const class Base2& __param_0) {
return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" class Base2& __rust_thunk___ZN5Base2aSEOS_(class Base2* __this,
+ class Base2&& __param_0) {
+ return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN7DerivedC1Ev(class Derived* __this) {
crubit::construct_at(std::forward<decltype(__this)>(__this));
}
@@ -64,6 +91,11 @@
crubit::construct_at(std::forward<decltype(__this)>(__this),
std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" void __rust_thunk___ZN7DerivedC1EOS_(class Derived* __this,
+ class Derived&& __param_0) {
+ crubit::construct_at(std::forward<decltype(__this)>(__this),
+ std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN7DerivedD1Ev(class Derived* __this) {
std::destroy_at(std::forward<decltype(__this)>(__this));
}
@@ -71,6 +103,10 @@
class Derived* __this, const class Derived& __param_0) {
return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" class Derived& __rust_thunk___ZN7DerivedaSEOS_(
+ class Derived* __this, class Derived&& __param_0) {
+ return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN12VirtualBase1C1Ev(
class VirtualBase1* __this) {
crubit::construct_at(std::forward<decltype(__this)>(__this));
@@ -80,6 +116,11 @@
crubit::construct_at(std::forward<decltype(__this)>(__this),
std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" void __rust_thunk___ZN12VirtualBase1C1EOS_(
+ class VirtualBase1* __this, class VirtualBase1&& __param_0) {
+ crubit::construct_at(std::forward<decltype(__this)>(__this),
+ std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN12VirtualBase1D1Ev(
class VirtualBase1* __this) {
std::destroy_at(std::forward<decltype(__this)>(__this));
@@ -88,6 +129,10 @@
class VirtualBase1* __this, const class VirtualBase1& __param_0) {
return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" class VirtualBase1& __rust_thunk___ZN12VirtualBase1aSEOS_(
+ class VirtualBase1* __this, class VirtualBase1&& __param_0) {
+ return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN12VirtualBase2C1Ev(
class VirtualBase2* __this) {
crubit::construct_at(std::forward<decltype(__this)>(__this));
@@ -97,6 +142,11 @@
crubit::construct_at(std::forward<decltype(__this)>(__this),
std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" void __rust_thunk___ZN12VirtualBase2C1EOS_(
+ class VirtualBase2* __this, class VirtualBase2&& __param_0) {
+ crubit::construct_at(std::forward<decltype(__this)>(__this),
+ std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN12VirtualBase2D1Ev(
class VirtualBase2* __this) {
std::destroy_at(std::forward<decltype(__this)>(__this));
@@ -105,6 +155,10 @@
class VirtualBase2* __this, const class VirtualBase2& __param_0) {
return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" class VirtualBase2& __rust_thunk___ZN12VirtualBase2aSEOS_(
+ class VirtualBase2* __this, class VirtualBase2&& __param_0) {
+ return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN14VirtualDerivedC1Ev(
class VirtualDerived* __this) {
crubit::construct_at(std::forward<decltype(__this)>(__this));
@@ -114,6 +168,11 @@
crubit::construct_at(std::forward<decltype(__this)>(__this),
std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" void __rust_thunk___ZN14VirtualDerivedC1EOS_(
+ class VirtualDerived* __this, class VirtualDerived&& __param_0) {
+ crubit::construct_at(std::forward<decltype(__this)>(__this),
+ std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN14VirtualDerivedD1Ev(
class VirtualDerived* __this) {
std::destroy_at(std::forward<decltype(__this)>(__this));
@@ -122,6 +181,10 @@
class VirtualDerived* __this, const class VirtualDerived& __param_0) {
return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" class VirtualDerived& __rust_thunk___ZN14VirtualDerivedaSEOS_(
+ class VirtualDerived* __this, class VirtualDerived&& __param_0) {
+ return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
+}
static_assert(sizeof(class Base0) == 1);
static_assert(alignof(class Base0) == 1);
diff --git a/rs_bindings_from_cc/test/golden/typedefs.h b/rs_bindings_from_cc/test/golden/typedefs.h
index f6a33ef..2a20ed4 100644
--- a/rs_bindings_from_cc/test/golden/typedefs.h
+++ b/rs_bindings_from_cc/test/golden/typedefs.h
@@ -5,6 +5,8 @@
#ifndef THIRD_PARTY_CRUBIT_RS_BINDINGS_FROM_CC_TEST_GOLDEN_TYPEDEFS_H_
#define THIRD_PARTY_CRUBIT_RS_BINDINGS_FROM_CC_TEST_GOLDEN_TYPEDEFS_H_
+#pragma clang lifetime_elision
+
struct SomeStruct {};
typedef struct SomeStruct SomeStruct;
diff --git a/rs_bindings_from_cc/test/golden/typedefs_rs_api.rs b/rs_bindings_from_cc/test/golden/typedefs_rs_api.rs
index 2dd8269..13a8ba5 100644
--- a/rs_bindings_from_cc/test/golden/typedefs_rs_api.rs
+++ b/rs_bindings_from_cc/test/golden/typedefs_rs_api.rs
@@ -5,7 +5,7 @@
// Automatically @generated Rust bindings for C++ target
// //rs_bindings_from_cc/test/golden:typedefs_cc
#![rustfmt::skip]
-#![feature(const_ptr_offset_from, custom_inner_attributes, negative_impls)]
+#![feature(const_ptr_offset_from, custom_inner_attributes, negative_impls, type_alias_impl_trait)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
@@ -24,31 +24,82 @@
}
forward_declare::unsafe_define!(forward_declare::symbol!("SomeStruct"), crate::SomeStruct);
-// rs_bindings_from_cc/test/golden/typedefs.h;l=8
-// Error while generating bindings for item 'SomeStruct::SomeStruct':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl ctor::CtorNew<()> for SomeStruct {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: ()) -> Self::CtorType {
+ let () = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN10SomeStructC1Ev(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ );
+ },
+ )
+ }
+}
-// rs_bindings_from_cc/test/golden/typedefs.h;l=8
-// Error while generating bindings for item 'SomeStruct::SomeStruct':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl<'b> ctor::CtorNew<&'b crate::SomeStruct> for SomeStruct {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: &'b crate::SomeStruct) -> Self::CtorType {
+ let __param_0 = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN10SomeStructC1ERKS_(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ __param_0,
+ );
+ },
+ )
+ }
+}
+impl<'b> ctor::CtorNew<(&'b crate::SomeStruct,)> for SomeStruct {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: (&'b crate::SomeStruct,)) -> Self::CtorType {
+ let (arg,) = args;
+ <Self as ctor::CtorNew<&'b crate::SomeStruct>>::ctor_new(arg)
+ }
+}
-// rs_bindings_from_cc/test/golden/typedefs.h;l=8
-// Error while generating bindings for item 'SomeStruct::SomeStruct':
-// Parameter #0 is not supported: Unsupported type 'struct SomeStruct &&': Unsupported type: && without lifetime
+impl<'b> ctor::CtorNew<ctor::RvalueReference<'b, crate::SomeStruct>> for SomeStruct {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: ctor::RvalueReference<'b, crate::SomeStruct>) -> Self::CtorType {
+ let __param_0 = args;
+ ctor::FnCtor::new(
+ move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
+ crate::detail::__rust_thunk___ZN10SomeStructC1EOS_(
+ crate::rust_std::pin::Pin::into_inner_unchecked(dest),
+ __param_0,
+ );
+ },
+ )
+ }
+}
+impl<'b> ctor::CtorNew<(ctor::RvalueReference<'b, crate::SomeStruct>,)> for SomeStruct {
+ type CtorType = impl ctor::Ctor<Output = Self>;
+ #[inline(always)]
+ fn ctor_new(args: (ctor::RvalueReference<'b, crate::SomeStruct>,)) -> Self::CtorType {
+ let (arg,) = args;
+ <Self as ctor::CtorNew<ctor::RvalueReference<'b, crate::SomeStruct>>>::ctor_new(arg)
+ }
+}
-// rs_bindings_from_cc/test/golden/typedefs.h;l=8
+// rs_bindings_from_cc/test/golden/typedefs.h;l=10
// Error while generating bindings for item 'SomeStruct::operator=':
// Bindings for this kind of operator are not supported
-// rs_bindings_from_cc/test/golden/typedefs.h;l=8
+// rs_bindings_from_cc/test/golden/typedefs.h;l=10
// Error while generating bindings for item 'SomeStruct::operator=':
-// Parameter #0 is not supported: Unsupported type 'struct SomeStruct &&': Unsupported type: && without lifetime
+// Bindings for this kind of operator are not supported
-// rs_bindings_from_cc/test/golden/typedefs.h;l=9
+// rs_bindings_from_cc/test/golden/typedefs.h;l=11
// Error while generating bindings for item 'SomeStruct':
// Typedef only used to introduce a name in C. Not importing.
-// rs_bindings_from_cc/test/golden/typedefs.h;l=11
+// rs_bindings_from_cc/test/golden/typedefs.h;l=13
// Error while generating bindings for item 'SomeOtherStruct':
// Unsupported type 'struct SomeOtherStruct': No generated bindings found for ''
@@ -59,36 +110,71 @@
}
forward_declare::unsafe_define!(forward_declare::symbol!("SomeUnion"), crate::SomeUnion);
-// rs_bindings_from_cc/test/golden/typedefs.h;l=14
-// Error while generating bindings for item 'SomeUnion::SomeUnion':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl Default for SomeUnion {
+ #[inline(always)]
+ fn default() -> Self {
+ let mut tmp = crate::rust_std::mem::MaybeUninit::<Self>::zeroed();
+ unsafe {
+ crate::detail::__rust_thunk___ZN9SomeUnionC1Ev(&mut tmp);
+ tmp.assume_init()
+ }
+ }
+}
-// rs_bindings_from_cc/test/golden/typedefs.h;l=14
-// Error while generating bindings for item 'SomeUnion::SomeUnion':
-// Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
+impl<'b> From<ctor::RvalueReference<'b, crate::SomeUnion>> for SomeUnion {
+ #[inline(always)]
+ fn from(__param_0: ctor::RvalueReference<'b, crate::SomeUnion>) -> Self {
+ let mut tmp = crate::rust_std::mem::MaybeUninit::<Self>::zeroed();
+ unsafe {
+ crate::detail::__rust_thunk___ZN9SomeUnionC1EOS_(&mut tmp, __param_0);
+ tmp.assume_init()
+ }
+ }
+}
-// rs_bindings_from_cc/test/golden/typedefs.h;l=14
-// Error while generating bindings for item 'SomeUnion::SomeUnion':
-// Parameter #0 is not supported: Unsupported type 'union SomeUnion &&': Unsupported type: && without lifetime
-
-// rs_bindings_from_cc/test/golden/typedefs.h;l=14
+// rs_bindings_from_cc/test/golden/typedefs.h;l=16
// Error while generating bindings for item 'SomeUnion::operator=':
// Bindings for this kind of operator are not supported
-// rs_bindings_from_cc/test/golden/typedefs.h;l=14
+// rs_bindings_from_cc/test/golden/typedefs.h;l=16
// Error while generating bindings for item 'SomeUnion::operator=':
-// Parameter #0 is not supported: Unsupported type 'union SomeUnion &&': Unsupported type: && without lifetime
+// Bindings for this kind of operator are not supported
-// rs_bindings_from_cc/test/golden/typedefs.h;l=15
+// rs_bindings_from_cc/test/golden/typedefs.h;l=17
// Error while generating bindings for item 'SomeUnion':
// Typedef only used to introduce a name in C. Not importing.
-// rs_bindings_from_cc/test/golden/typedefs.h;l=17
+// rs_bindings_from_cc/test/golden/typedefs.h;l=19
// Error while generating bindings for item 'SomeOtherUnion':
// Unsupported type 'union SomeOtherUnion': No generated bindings found for ''
// THIRD_PARTY_CRUBIT_RS_BINDINGS_FROM_CC_TEST_GOLDEN_TYPEDEFS_H_
+mod detail {
+ #[allow(unused_imports)]
+ use super::*;
+ extern "C" {
+ pub(crate) fn __rust_thunk___ZN10SomeStructC1Ev<'a>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::SomeStruct>,
+ );
+ pub(crate) fn __rust_thunk___ZN10SomeStructC1ERKS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::SomeStruct>,
+ __param_0: &'b crate::SomeStruct,
+ );
+ pub(crate) fn __rust_thunk___ZN10SomeStructC1EOS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::SomeStruct>,
+ __param_0: ctor::RvalueReference<'b, crate::SomeStruct>,
+ );
+ pub(crate) fn __rust_thunk___ZN9SomeUnionC1Ev<'a>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::SomeUnion>,
+ );
+ pub(crate) fn __rust_thunk___ZN9SomeUnionC1EOS_<'a, 'b>(
+ __this: &'a mut crate::rust_std::mem::MaybeUninit<crate::SomeUnion>,
+ __param_0: ctor::RvalueReference<'b, crate::SomeUnion>,
+ );
+ }
+}
+
const _: () = assert!(rust_std::mem::size_of::<Option<&i32>>() == rust_std::mem::size_of::<&i32>());
const _: () = assert!(rust_std::mem::size_of::<crate::SomeStruct>() == 1);
diff --git a/rs_bindings_from_cc/test/golden/typedefs_rs_api_impl.cc b/rs_bindings_from_cc/test/golden/typedefs_rs_api_impl.cc
index aeb4df0..3d0ecef 100644
--- a/rs_bindings_from_cc/test/golden/typedefs_rs_api_impl.cc
+++ b/rs_bindings_from_cc/test/golden/typedefs_rs_api_impl.cc
@@ -19,6 +19,11 @@
crubit::construct_at(std::forward<decltype(__this)>(__this),
std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" void __rust_thunk___ZN10SomeStructC1EOS_(
+ class SomeStruct* __this, class SomeStruct&& __param_0) {
+ crubit::construct_at(std::forward<decltype(__this)>(__this),
+ std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN10SomeStructD1Ev(class SomeStruct* __this) {
std::destroy_at(std::forward<decltype(__this)>(__this));
}
@@ -26,6 +31,10 @@
class SomeStruct* __this, const class SomeStruct& __param_0) {
return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" class SomeStruct& __rust_thunk___ZN10SomeStructaSEOS_(
+ class SomeStruct* __this, class SomeStruct&& __param_0) {
+ return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN9SomeUnionC1Ev(union SomeUnion* __this) {
crubit::construct_at(std::forward<decltype(__this)>(__this));
}
@@ -34,6 +43,11 @@
crubit::construct_at(std::forward<decltype(__this)>(__this),
std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" void __rust_thunk___ZN9SomeUnionC1EOS_(union SomeUnion* __this,
+ union SomeUnion&& __param_0) {
+ crubit::construct_at(std::forward<decltype(__this)>(__this),
+ std::forward<decltype(__param_0)>(__param_0));
+}
extern "C" void __rust_thunk___ZN9SomeUnionD1Ev(union SomeUnion* __this) {
std::destroy_at(std::forward<decltype(__this)>(__this));
}
@@ -41,6 +55,10 @@
union SomeUnion* __this, const union SomeUnion& __param_0) {
return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
}
+extern "C" union SomeUnion& __rust_thunk___ZN9SomeUnionaSEOS_(
+ union SomeUnion* __this, union SomeUnion&& __param_0) {
+ return __this->operator=(std::forward<decltype(__param_0)>(__param_0));
+}
static_assert(sizeof(class SomeStruct) == 1);
static_assert(alignof(class SomeStruct) == 1);