Skip to content

Commit 6611276

Browse files
committed
Test for ctypes-prefix, and use-core without libstd.
1 parent 2b77970 commit 6611276

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

tests/expectations/tests/no-std.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* automatically generated by rust-bindgen */
2+
3+
4+
#![allow(non_snake_case)]
5+
6+
#![no_std]
7+
mod libc { pub type c_int = i32; pub enum c_void {} }
8+
9+
#[repr(C)]
10+
#[derive(Debug, Copy)]
11+
pub struct foo {
12+
pub a: libc::c_int,
13+
pub b: libc::c_int,
14+
pub bar: *mut libc::c_void,
15+
}
16+
#[test]
17+
fn bindgen_test_layout_foo() {
18+
assert_eq!(::core::mem::size_of::<foo>() , 16usize);
19+
assert_eq!(::core::mem::align_of::<foo>() , 8usize);
20+
}
21+
impl Clone for foo {
22+
fn clone(&self) -> Self { *self }
23+
}

tests/headers/no-std.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// bindgen-flags: --ctypes-prefix "libc" --use-core --raw-line "#![no_std]" --raw-line "mod libc { pub type c_int = i32; pub enum c_void {} }"
2+
struct foo {
3+
int a, b;
4+
void* bar;
5+
};

0 commit comments

Comments
 (0)