summaryrefslogtreecommitdiffstats
path: root/tests/rust/ptrs_as_arrays.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rust/ptrs_as_arrays.rs')
-rw-r--r--tests/rust/ptrs_as_arrays.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/rust/ptrs_as_arrays.rs b/tests/rust/ptrs_as_arrays.rs
new file mode 100644
index 0000000..02cb908
--- /dev/null
+++ b/tests/rust/ptrs_as_arrays.rs
@@ -0,0 +1,19 @@
+/// cbindgen:ptrs-as-arrays=[[arg;3]]
+#[no_mangle]
+pub unsafe extern "C" fn ptr_as_array(n: u32, arg: *const u32, v: *const u64) {}
+
+/// cbindgen:ptrs-as-arrays=[[arg;3], [v; 4]]
+#[no_mangle]
+pub unsafe extern "C" fn ptr_as_array1(n: u32, arg: *const u32, v: *mut u64) {}
+
+/// cbindgen:ptrs-as-arrays=[[n;2], [arg; ], [v;], [k; 3]]
+#[no_mangle]
+pub unsafe extern "C" fn ptr_as_array2(n: u32, arg: *mut u32, v: *const u64) {}
+
+/// cbindgen:ptrs-as-arrays=[[a;2;3]]
+#[no_mangle]
+pub unsafe extern "C" fn ptr_as_array_wrong_syntax(arg: *mut u32, v: *const u32, _: *const u32) {}
+
+/// cbindgen:ptrs-as-arrays=[[_;2], [_;3]]
+#[no_mangle]
+pub unsafe extern "C" fn ptr_as_array_unnamed(_: *mut u32, _: *const u32) {}