blob: 8b36864196346fcf16a5f68e9f55f3108da3af19 [file] [log] [blame]
Rosica Dejanovskadd9a9032022-04-12 07:34:41 -07001// Part of the Crubit project, under the Apache License v2.0 with LLVM
2// Exceptions. See /LICENSE for license information.
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5// Automatically @generated Rust bindings for C++ target
6// //rs_bindings_from_cc/test/golden:namespace_cc
7#![rustfmt::skip]
8#![feature(const_ptr_offset_from, custom_inner_attributes, negative_impls)]
9#![allow(non_camel_case_types)]
10#![allow(non_snake_case)]
11
12use ::std as rust_std;
13use memoffset_unstable_const::offset_of;
14
15// Part of the Crubit project, under the Apache License v2.0 with LLVM
16// Exceptions. See /LICENSE for license information.
17// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
18
19pub mod test_namespace_bindings {
Marcel Hlopko16da7b02022-05-04 04:47:01 -070020 use super::*;
21
Rosica Dejanovskadd9a9032022-04-12 07:34:41 -070022 #[repr(C)]
23 pub struct S {
24 pub i: i32,
25 }
Rosica Dejanovska8283fe62022-05-09 10:04:28 -070026 forward_declare::unsafe_define!(
27 forward_declare::symbol!("S"),
28 crate::test_namespace_bindings::S
29 );
Rosica Dejanovskadd9a9032022-04-12 07:34:41 -070030
31 impl !Unpin for S {}
32
33 // rs_bindings_from_cc/test/golden/namespace.h;l=9
34 // Error while generating bindings for item 'S::S':
35 // Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
36
37 // rs_bindings_from_cc/test/golden/namespace.h;l=9
38 // Error while generating bindings for item 'S::S':
39 // Unsafe constructors (e.g. with no elided or explicit lifetimes) are intentionally not supported
40
41 // rs_bindings_from_cc/test/golden/namespace.h;l=9
42 // Error while generating bindings for item 'test_namespace_bindings::S::S':
43 // Parameter #0 is not supported: Unsupported type 'struct test_namespace_bindings::S &&': Unsupported type: && without lifetime
44
45 // rs_bindings_from_cc/test/golden/namespace.h;l=9
46 // Error while generating bindings for item 'S::operator=':
47 // Bindings for this kind of operator are not supported
48
49 // rs_bindings_from_cc/test/golden/namespace.h;l=9
50 // Error while generating bindings for item 'test_namespace_bindings::S::operator=':
51 // Parameter #0 is not supported: Unsupported type 'struct test_namespace_bindings::S &&': Unsupported type: && without lifetime
52
53 /// Free comment inside namespace
54 #[inline(always)]
Rosica Dejanovska8283fe62022-05-09 10:04:28 -070055 pub fn f(s: crate::test_namespace_bindings::S) -> i32 {
Rosica Dejanovskadd9a9032022-04-12 07:34:41 -070056 unsafe { detail::__rust_thunk___ZN23test_namespace_bindings1fENS_1SE(s) }
57 }
58
59 pub mod inner {
Marcel Hlopko16da7b02022-05-04 04:47:01 -070060 use super::*;
61
Rosica Dejanovskadd9a9032022-04-12 07:34:41 -070062 #[inline(always)]
63 pub fn i() {
64 unsafe { detail::__rust_thunk___ZN23test_namespace_bindings5inner1iEv() }
65 }
66
67 mod detail {
68 #[allow(unused_imports)]
69 use super::*;
70 extern "C" {
71 #[link_name = "_ZN23test_namespace_bindings5inner1iEv"]
72 pub(crate) fn __rust_thunk___ZN23test_namespace_bindings5inner1iEv();
73 }
74 }
75 }
76
77 // namespace inner
78
79 mod detail {
80 #[allow(unused_imports)]
81 use super::*;
82 extern "C" {
83 #[link_name = "_ZN23test_namespace_bindings1fENS_1SE"]
Rosica Dejanovska8283fe62022-05-09 10:04:28 -070084 pub(crate) fn __rust_thunk___ZN23test_namespace_bindings1fENS_1SE(
85 s: crate::test_namespace_bindings::S,
86 ) -> i32;
Rosica Dejanovskadd9a9032022-04-12 07:34:41 -070087 }
88 }
89
Rosica Dejanovska8283fe62022-05-09 10:04:28 -070090 const _: () = assert!(rust_std::mem::size_of::<crate::test_namespace_bindings::S>() == 4usize);
91 const _: () = assert!(rust_std::mem::align_of::<crate::test_namespace_bindings::S>() == 4usize);
Rosica Dejanovskadd9a9032022-04-12 07:34:41 -070092 const _: () = {
Rosica Dejanovska8283fe62022-05-09 10:04:28 -070093 static_assertions::assert_not_impl_all!(crate::test_namespace_bindings::S: Copy);
Rosica Dejanovskadd9a9032022-04-12 07:34:41 -070094 };
95 const _: () = {
Rosica Dejanovska8283fe62022-05-09 10:04:28 -070096 static_assertions::assert_not_impl_all!(crate::test_namespace_bindings::S: Drop);
Rosica Dejanovskadd9a9032022-04-12 07:34:41 -070097 };
Rosica Dejanovska8283fe62022-05-09 10:04:28 -070098 const _: () = assert!(offset_of!(crate::test_namespace_bindings::S, i) * 8 == 0usize);
Rosica Dejanovskadd9a9032022-04-12 07:34:41 -070099}
100
101// namespace test_namespace_bindings
102
Rosica Dejanovska8283fe62022-05-09 10:04:28 -0700103#[inline(always)]
104pub fn identity(s: crate::test_namespace_bindings::S) -> crate::test_namespace_bindings::S {
105 unsafe { detail::__rust_thunk___Z8identityN23test_namespace_bindings1SE(s) }
106}
107
Rosica Dejanovskadd9a9032022-04-12 07:34:41 -0700108// THIRD_PARTY_CRUBIT_RS_BINDINGS_FROM_CC_TEST_GOLDEN_NAMESPACE_H_
109
Rosica Dejanovska8283fe62022-05-09 10:04:28 -0700110mod detail {
111 #[allow(unused_imports)]
112 use super::*;
113 extern "C" {
114 #[link_name = "_Z8identityN23test_namespace_bindings1SE"]
115 pub(crate) fn __rust_thunk___Z8identityN23test_namespace_bindings1SE(
116 s: crate::test_namespace_bindings::S,
117 ) -> crate::test_namespace_bindings::S;
118 }
119}
120
Rosica Dejanovskadd9a9032022-04-12 07:34:41 -0700121const _: () = assert!(rust_std::mem::size_of::<Option<&i32>>() == rust_std::mem::size_of::<&i32>());