Rosica Dejanovska | dd9a903 | 2022-04-12 07:34:41 -0700 | [diff] [blame] | 1 | // 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 | |
| 12 | use ::std as rust_std; |
| 13 | use 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 | |
| 19 | pub mod test_namespace_bindings { |
Marcel Hlopko | 16da7b0 | 2022-05-04 04:47:01 -0700 | [diff] [blame] | 20 | use super::*; |
| 21 | |
Rosica Dejanovska | dd9a903 | 2022-04-12 07:34:41 -0700 | [diff] [blame] | 22 | #[repr(C)] |
| 23 | pub struct S { |
| 24 | pub i: i32, |
| 25 | } |
Rosica Dejanovska | 8283fe6 | 2022-05-09 10:04:28 -0700 | [diff] [blame^] | 26 | forward_declare::unsafe_define!( |
| 27 | forward_declare::symbol!("S"), |
| 28 | crate::test_namespace_bindings::S |
| 29 | ); |
Rosica Dejanovska | dd9a903 | 2022-04-12 07:34:41 -0700 | [diff] [blame] | 30 | |
| 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 Dejanovska | 8283fe6 | 2022-05-09 10:04:28 -0700 | [diff] [blame^] | 55 | pub fn f(s: crate::test_namespace_bindings::S) -> i32 { |
Rosica Dejanovska | dd9a903 | 2022-04-12 07:34:41 -0700 | [diff] [blame] | 56 | unsafe { detail::__rust_thunk___ZN23test_namespace_bindings1fENS_1SE(s) } |
| 57 | } |
| 58 | |
| 59 | pub mod inner { |
Marcel Hlopko | 16da7b0 | 2022-05-04 04:47:01 -0700 | [diff] [blame] | 60 | use super::*; |
| 61 | |
Rosica Dejanovska | dd9a903 | 2022-04-12 07:34:41 -0700 | [diff] [blame] | 62 | #[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 Dejanovska | 8283fe6 | 2022-05-09 10:04:28 -0700 | [diff] [blame^] | 84 | pub(crate) fn __rust_thunk___ZN23test_namespace_bindings1fENS_1SE( |
| 85 | s: crate::test_namespace_bindings::S, |
| 86 | ) -> i32; |
Rosica Dejanovska | dd9a903 | 2022-04-12 07:34:41 -0700 | [diff] [blame] | 87 | } |
| 88 | } |
| 89 | |
Rosica Dejanovska | 8283fe6 | 2022-05-09 10:04:28 -0700 | [diff] [blame^] | 90 | 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 Dejanovska | dd9a903 | 2022-04-12 07:34:41 -0700 | [diff] [blame] | 92 | const _: () = { |
Rosica Dejanovska | 8283fe6 | 2022-05-09 10:04:28 -0700 | [diff] [blame^] | 93 | static_assertions::assert_not_impl_all!(crate::test_namespace_bindings::S: Copy); |
Rosica Dejanovska | dd9a903 | 2022-04-12 07:34:41 -0700 | [diff] [blame] | 94 | }; |
| 95 | const _: () = { |
Rosica Dejanovska | 8283fe6 | 2022-05-09 10:04:28 -0700 | [diff] [blame^] | 96 | static_assertions::assert_not_impl_all!(crate::test_namespace_bindings::S: Drop); |
Rosica Dejanovska | dd9a903 | 2022-04-12 07:34:41 -0700 | [diff] [blame] | 97 | }; |
Rosica Dejanovska | 8283fe6 | 2022-05-09 10:04:28 -0700 | [diff] [blame^] | 98 | const _: () = assert!(offset_of!(crate::test_namespace_bindings::S, i) * 8 == 0usize); |
Rosica Dejanovska | dd9a903 | 2022-04-12 07:34:41 -0700 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | // namespace test_namespace_bindings |
| 102 | |
Rosica Dejanovska | 8283fe6 | 2022-05-09 10:04:28 -0700 | [diff] [blame^] | 103 | #[inline(always)] |
| 104 | pub 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 Dejanovska | dd9a903 | 2022-04-12 07:34:41 -0700 | [diff] [blame] | 108 | // THIRD_PARTY_CRUBIT_RS_BINDINGS_FROM_CC_TEST_GOLDEN_NAMESPACE_H_ |
| 109 | |
Rosica Dejanovska | 8283fe6 | 2022-05-09 10:04:28 -0700 | [diff] [blame^] | 110 | mod 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 Dejanovska | dd9a903 | 2022-04-12 07:34:41 -0700 | [diff] [blame] | 121 | const _: () = assert!(rust_std::mem::size_of::<Option<&i32>>() == rust_std::mem::size_of::<&i32>()); |