summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/expectations/tests/no-std.rs23
-rw-r--r--tests/headers/no-std.h5
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/expectations/tests/no-std.rs b/tests/expectations/tests/no-std.rs
new file mode 100644
index 00000000..f50a889d
--- /dev/null
+++ b/tests/expectations/tests/no-std.rs
@@ -0,0 +1,23 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+#![no_std]
+mod libc { pub type c_int = i32; pub enum c_void {} }
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct foo {
+ pub a: libc::c_int,
+ pub b: libc::c_int,
+ pub bar: *mut libc::c_void,
+}
+#[test]
+fn bindgen_test_layout_foo() {
+ assert_eq!(::core::mem::size_of::<foo>() , 16usize);
+ assert_eq!(::core::mem::align_of::<foo>() , 8usize);
+}
+impl Clone for foo {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/headers/no-std.h b/tests/headers/no-std.h
new file mode 100644
index 00000000..7bee9657
--- /dev/null
+++ b/tests/headers/no-std.h
@@ -0,0 +1,5 @@
+// bindgen-flags: --ctypes-prefix "libc" --use-core --raw-line "#![no_std]" --raw-line "mod libc { pub type c_int = i32; pub enum c_void {} }"
+struct foo {
+ int a, b;
+ void* bar;
+};