diff options
-rw-r--r-- | Cargo.toml | 1 | ||||
-rw-r--r-- | src/clang.rs | 5 | ||||
-rw-r--r-- | src/gen.rs | 6 | ||||
-rw-r--r-- | src/parser.rs | 4 | ||||
-rw-r--r-- | tests/cmath.rs | 2 | ||||
-rw-r--r-- | tests/struct.rs | 10 | ||||
-rw-r--r-- | tests/union.rs | 10 |
7 files changed, 20 insertions, 18 deletions
@@ -16,3 +16,4 @@ plugin = true [[bin]] name = "bindgen" +doc = false diff --git a/src/clang.rs b/src/clang.rs index b728b9f9..6f7ab574 100644 --- a/src/clang.rs +++ b/src/clang.rs @@ -1,7 +1,7 @@ #![allow(non_upper_case_globals)] use libc::{c_uint, c_char, c_int, c_ulong}; -use std::{mem, io, ptr, string}; +use std::{mem, io, ptr}; use std::fmt; use std::hash::Hash; use std::hash::sip::SipState; @@ -53,7 +53,8 @@ impl Cursor { pub fn visit(&self, func: CursorVisitor) { unsafe { let data = mem::transmute::<&CursorVisitor, CXClientData>(&func); - clang_visitChildren(self.x, Some(visit_children), data); + let opt_visit = Some(visit_children as extern "C" fn(CXCursor, CXCursor, CXClientData) -> Enum_CXChildVisitResult); + clang_visitChildren(self.x, opt_visit, data); }; } @@ -5,7 +5,7 @@ use std::iter; use std::vec::Vec; use std::rc::Rc; use std::collections::HashMap; -use std::collections::hash_map::{Occupied, Vacant}; +use std::collections::hash_map::Entry; use syntax::abi; use syntax::ast; @@ -225,10 +225,10 @@ pub fn gen_mod(links: &[(String, Option<String>)], globs: Vec<Global>, span: Spa let mut map: HashMap<abi::Abi, Vec<_>> = HashMap::new(); for (abi, func) in func_list { match map.entry(abi) { - Occupied(mut occ) => { + Entry::Occupied(mut occ) => { occ.get_mut().push(func); } - Vacant(vac) => { + Entry::Vacant(vac) => { vac.set(vec!(func)); } } diff --git a/src/parser.rs b/src/parser.rs index 363e0b1a..043c1ed4 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -63,8 +63,8 @@ fn decl_name(ctx: &mut ClangParserCtx, cursor: &Cursor) -> Global { let mut new_decl = false; let override_enum_ty = ctx.options.override_enum_ty; let decl = match ctx.name.entry(*cursor) { - hash_map::Occupied(ref e) => e.get().clone(), - hash_map::Vacant(e) => { + hash_map::Entry::Occupied(ref e) => e.get().clone(), + hash_map::Entry::Vacant(e) => { new_decl = true; let spelling = cursor.spelling(); let ty = cursor.cur_type(); diff --git a/tests/cmath.rs b/tests/cmath.rs index 97217c53..f3fa1840 100644 --- a/tests/cmath.rs +++ b/tests/cmath.rs @@ -10,7 +10,7 @@ extern crate libc; #[allow(non_camel_case_types)] #[allow(non_upper_case_globals)] pub mod ffi { - bindgen!("/usr/include/math.h", link = "m") + bindgen!("/usr/include/math.h", link = "m"); } #[test] diff --git a/tests/struct.rs b/tests/struct.rs index ec1faa4f..980ea558 100644 --- a/tests/struct.rs +++ b/tests/struct.rs @@ -7,7 +7,7 @@ extern crate libc; #[test] fn test_struct_with_anon_struct() { - mod ffi { bindgen!("headers/struct_with_anon_struct.h") } + mod ffi { bindgen!("headers/struct_with_anon_struct.h"); } let mut x = ffi::Struct_foo { bar: ffi::Struct_Unnamed1 { a: 0, b: 0 } }; x.bar.a = 1; @@ -19,7 +19,7 @@ fn test_struct_with_anon_struct() { #[test] fn test_struct_with_anon_union() { - mod ffi { bindgen!("headers/struct_with_anon_union.h") } + mod ffi { bindgen!("headers/struct_with_anon_union.h"); } let mut x = ffi::Struct_foo { bar: ffi::Union_Unnamed1 { _bindgen_data_: [0] } }; unsafe { @@ -31,7 +31,7 @@ fn test_struct_with_anon_union() { #[test] fn test_struct_with_anon_unnamed_struct() { - mod ffi { bindgen!("headers/struct_with_anon_unnamed_struct.h") } + mod ffi { bindgen!("headers/struct_with_anon_unnamed_struct.h"); } let mut x = ffi::Struct_foo { _bindgen_data_1_: [0, 0] }; unsafe { @@ -44,7 +44,7 @@ fn test_struct_with_anon_unnamed_struct() { #[test] fn test_struct_with_anon_unnamed_union() { - mod ffi { bindgen!("headers/struct_with_anon_unnamed_union.h") } + mod ffi { bindgen!("headers/struct_with_anon_unnamed_union.h"); } let mut x = ffi::Struct_foo { _bindgen_data_1_: [0] }; unsafe { @@ -56,7 +56,7 @@ fn test_struct_with_anon_unnamed_union() { #[test] fn test_struct_with_nesting() { - mod ffi { bindgen!("headers/struct_with_nesting.h") } + mod ffi { bindgen!("headers/struct_with_nesting.h"); } let mut x = ffi::Struct_foo { a: 0, _bindgen_data_1_: [0] }; unsafe { diff --git a/tests/union.rs b/tests/union.rs index aae1e65d..2bdb313e 100644 --- a/tests/union.rs +++ b/tests/union.rs @@ -9,7 +9,7 @@ extern crate libc; fn test_union_with_anon_struct() { // XXX: Rustc thinks that the anonymous struct, bar, is unused. #[allow(dead_code)] - mod ffi { bindgen!("headers/union_with_anon_struct.h") } + mod ffi { bindgen!("headers/union_with_anon_struct.h"); } let mut x = ffi::Union_foo { _bindgen_data_: [0, 0] }; unsafe { @@ -23,7 +23,7 @@ fn test_union_with_anon_struct() { #[test] fn test_union_with_anon_union() { - mod ffi { bindgen!("headers/union_with_anon_union.h") } + mod ffi { bindgen!("headers/union_with_anon_union.h"); } let mut x = ffi::Union_foo { _bindgen_data_: [0] }; unsafe { @@ -36,7 +36,7 @@ fn test_union_with_anon_union() { #[test] fn test_union_with_anon_unnamed_struct() { - mod ffi { bindgen!("headers/union_with_anon_unnamed_struct.h") } + mod ffi { bindgen!("headers/union_with_anon_unnamed_struct.h"); } let mut x = ffi::Union_pixel { _bindgen_data_: [0] }; unsafe { @@ -55,7 +55,7 @@ fn test_union_with_anon_unnamed_struct() { #[test] fn test_union_with_anon_unnamed_union() { - mod ffi { bindgen!("headers/union_with_anon_unnamed_union.h") } + mod ffi { bindgen!("headers/union_with_anon_unnamed_union.h"); } let mut x = ffi::Union_foo { _bindgen_data_: [0] }; unsafe { @@ -69,7 +69,7 @@ fn test_union_with_anon_unnamed_union() { #[test] fn test_union_with_nesting() { - mod ffi { bindgen!("headers/union_with_nesting.h") } + mod ffi { bindgen!("headers/union_with_nesting.h"); } let mut x = ffi::Union_foo { _bindgen_data_: [0] }; unsafe { |