Skip to content

Commit

Permalink
Test for ctypes-prefix, and use-core without libstd.
Browse files Browse the repository at this point in the history
  • Loading branch information
emilio committed Nov 6, 2016
1 parent 2b77970 commit 6611276
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/expectations/tests/no-std.rs
Original file line number Diff line number Diff line change
@@ -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 }
}
5 changes: 5 additions & 0 deletions tests/headers/no-std.h
Original file line number Diff line number Diff line change
@@ -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;
};

0 comments on commit 6611276

Please sign in to comment.