File tree Expand file tree Collapse file tree 5 files changed +38
-0
lines changed Expand file tree Collapse file tree 5 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -46,5 +46,10 @@ pub mod ffi2 {
46
46
fn c_return_ns_opaque_ptr ( ) -> UniquePtr < F > ;
47
47
fn c_return_ns_unique_ptr ( ) -> UniquePtr < H > ;
48
48
fn c_take_ref_ns_c ( h : & H ) ;
49
+
50
+ #[ namespace ( namespace = other) ]
51
+ fn ns_c_take_trivial ( d : D ) ;
52
+ #[ namespace ( namespace = other) ]
53
+ fn ns_c_return_trivial ( ) -> D ;
49
54
}
50
55
}
Original file line number Diff line number Diff line change @@ -199,6 +199,9 @@ pub mod ffi {
199
199
fn cOverloadedFunction ( x : i32 ) -> String ;
200
200
#[ rust_name = "str_overloaded_function" ]
201
201
fn cOverloadedFunction ( x : & str ) -> String ;
202
+
203
+ #[ namespace ( namespace = other) ]
204
+ fn ns_c_take_ns_shared ( shared : AShared ) ;
202
205
}
203
206
204
207
extern "C" {
Original file line number Diff line number Diff line change @@ -627,3 +627,24 @@ extern "C" const char *cxx_run_test() noexcept {
627
627
}
628
628
629
629
} // namespace tests
630
+
631
+ namespace other {
632
+
633
+ void ns_c_take_trivial (::tests::D d) {
634
+ if (d.d == 30 ) {
635
+ cxx_test_suite_set_correct ();
636
+ }
637
+ }
638
+
639
+ ::tests::D ns_c_return_trivial () {
640
+ ::tests::D d;
641
+ d.d = 30 ;
642
+ return d;
643
+ }
644
+
645
+ void ns_c_take_ns_shared (::A::AShared shared) {
646
+ if (shared.z == 2020 ) {
647
+ cxx_test_suite_set_correct ();
648
+ }
649
+ }
650
+ }
Original file line number Diff line number Diff line change @@ -177,3 +177,9 @@ rust::String cOverloadedFunction(int32_t x);
177
177
rust::String cOverloadedFunction (rust::Str x);
178
178
179
179
} // namespace tests
180
+
181
+ namespace other {
182
+ void ns_c_take_trivial (::tests::D d);
183
+ ::tests::D ns_c_return_trivial ();
184
+ void ns_c_take_ns_shared (::A::AShared shared);
185
+ } // namespace other
Original file line number Diff line number Diff line change @@ -103,6 +103,7 @@ fn test_c_take() {
103
103
check ! ( ffi:: c_take_primitive( 2020 ) ) ;
104
104
check ! ( ffi:: c_take_shared( ffi:: Shared { z: 2020 } ) ) ;
105
105
check ! ( ffi:: c_take_ns_shared( ffi:: AShared { z: 2020 } ) ) ;
106
+ check ! ( ffi:: ns_c_take_ns_shared( ffi:: AShared { z: 2020 } ) ) ;
106
107
check ! ( ffi:: c_take_nested_ns_shared( ffi:: ABShared { z: 2020 } ) ) ;
107
108
check ! ( ffi:: c_take_box( Box :: new( 2020 ) ) ) ;
108
109
check ! ( ffi:: c_take_ref_c( & unique_ptr) ) ;
@@ -226,6 +227,8 @@ fn test_extern_trivial() {
226
227
let d = ffi2:: c_return_trivial_ptr ( ) ;
227
228
check ! ( ffi2:: c_take_trivial_ptr( d) ) ;
228
229
cxx:: UniquePtr :: new ( ffi2:: D { d : 42 } ) ;
230
+ let d = ffi2:: ns_c_return_trivial ( ) ;
231
+ check ! ( ffi2:: ns_c_take_trivial( d) ) ;
229
232
230
233
let g = ffi2:: c_return_trivial_ns ( ) ;
231
234
check ! ( ffi2:: c_take_trivial_ns_ref( & g) ) ;
You can’t perform that action at this time.
0 commit comments