diff options
author | Emilio Cobos Álvarez <ecoal95@gmail.com> | 2016-11-06 12:51:55 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <ecoal95@gmail.com> | 2016-11-06 12:51:55 +0100 |
commit | 6611276ee1f49998af7c31d18640f24c37788e56 (patch) | |
tree | d2032d21d07afc73035da332f5dc6b1436415661 | |
parent | 2b77970303764ce1bfb14f29058bde3f5cd635cd (diff) |
Test for ctypes-prefix, and use-core without libstd.
-rw-r--r-- | tests/expectations/tests/no-std.rs | 23 | ||||
-rw-r--r-- | tests/headers/no-std.h | 5 |
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; +}; |