summaryrefslogtreecommitdiffstats
path: root/tests/rust/forward_declaration.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rust/forward_declaration.rs')
-rw-r--r--tests/rust/forward_declaration.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/rust/forward_declaration.rs b/tests/rust/forward_declaration.rs
new file mode 100644
index 0000000..e97b63e
--- /dev/null
+++ b/tests/rust/forward_declaration.rs
@@ -0,0 +1,21 @@
+#[repr(C)]
+struct TypeInfo {
+ data: TypeData,
+}
+
+#[repr(C)]
+enum TypeData {
+ Primitive,
+ Struct(StructInfo),
+}
+
+#[repr(C)]
+struct StructInfo {
+ fields: *const *const TypeInfo, // requires forward declaration
+ num_fields: usize,
+}
+
+#[no_mangle]
+pub extern "C" fn root(
+ x: TypeInfo,
+) {}