diff options
author | Edward Barnard <eabarnard@gmail.com> | 2015-01-03 14:27:03 +0000 |
---|---|---|
committer | Edward Barnard <eabarnard@gmail.com> | 2015-01-03 14:37:22 +0000 |
commit | a78f887c3db5907e6f3cd16066f139a970d21d8f (patch) | |
tree | c9994f88c2f964477c1fbcb483fd7eaccfb26439 | |
parent | d120a06a07bf13a255899d5cfff334e4b0467ad0 (diff) |
Fix build
-rw-r--r-- | src/clang.rs | 2 | ||||
-rw-r--r-- | src/gen.rs | 4 | ||||
-rw-r--r-- | src/parser.rs | 1 | ||||
-rw-r--r-- | tests/test_decl.rs | 2 | ||||
-rw-r--r-- | tests/test_func.rs | 2 | ||||
-rw-r--r-- | tests/test_struct.rs | 12 | ||||
-rw-r--r-- | tests/test_union.rs | 4 |
7 files changed, 14 insertions, 13 deletions
diff --git a/src/clang.rs b/src/clang.rs index 547de2e6..46cf2eff 100644 --- a/src/clang.rs +++ b/src/clang.rs @@ -5,7 +5,7 @@ use std::{mem, io, ptr}; use std::fmt; use std::hash::Hash; use std::hash::sip::SipState; -use std::c_str::CString; +use std::c_str::{CString, ToCStr}; pub use clangll as ll; use clangll::*; @@ -694,7 +694,7 @@ fn gen_comp_methods(ctx: &mut GenCtx, data_field: &str, data_offset: uint, } ) } else { - let offset_expr = &ctx.ext_cx.expr_int(ctx.span, offset.to_int().unwrap()); + let offset_expr = &ctx.ext_cx.expr_int(ctx.span, offset as int); quote_method!(&ctx.ext_cx, pub unsafe fn $f_name_ident(&mut self) -> $ret_ty { let raw: *mut u8 = ::std::mem::transmute(&self.$data_ident); @@ -801,7 +801,7 @@ fn mk_repr_attr(ctx: &mut GenCtx) -> ast::Attribute { fn mk_deriving_copy_attr(ctx: &mut GenCtx) -> ast::Attribute { let attr_val = P(respan(ctx.span, ast::MetaList( - to_intern_str(ctx, "deriving".to_string()), + to_intern_str(ctx, "derive".to_string()), vec!(P(respan(ctx.span, ast::MetaWord(to_intern_str(ctx, "Copy".to_string()))))) ))); diff --git a/src/parser.rs b/src/parser.rs index 5740f52b..96065969 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -5,6 +5,7 @@ use std::collections::{HashMap, HashSet}; use std::collections::hash_map; use std::cell::RefCell; use std::iter::AdditiveIterator; +use std::ops::Deref; use std::rc::Rc; use syntax::abi; diff --git a/tests/test_decl.rs b/tests/test_decl.rs index 5f83d00b..6178a822 100644 --- a/tests/test_decl.rs +++ b/tests/test_decl.rs @@ -3,7 +3,7 @@ fn ptr_to_array() { assert_bind_eq!("headers/decl_ptr_to_array.h", cx, quote_item!(cx, extern "C" { - pub static mut foo: [::libc::c_int, ..1u]; + pub static mut foo: [::libc::c_int; 1u]; } ) ); diff --git a/tests/test_func.rs b/tests/test_func.rs index 58faf37e..0e3c5f74 100644 --- a/tests/test_func.rs +++ b/tests/test_func.rs @@ -16,7 +16,7 @@ fn func_ptr_in_struct() { assert_bind_eq!("headers/func_ptr_in_struct.h", cx, quote_item!(cx, #[repr(C)] - #[deriving(Copy)] + #[derive(Copy)] pub struct Struct_Foo { pub bar: ::std::option::Option< extern "C" fn(x: ::libc::c_int, diff --git a/tests/test_struct.rs b/tests/test_struct.rs index 3a9e3550..68078a33 100644 --- a/tests/test_struct.rs +++ b/tests/test_struct.rs @@ -17,7 +17,7 @@ fn with_anon_struct_array() { assert_bind_eq!("headers/struct_with_anon_struct_array.h", cx, quote_item!(cx, #[repr(C)] - #[deriving(Copy)] + #[derive(Copy)] pub struct Struct_foo { pub bar: [Struct_Unnamed1; 2u], pub baz: [[[Struct_Unnamed2; 4u]; 3u]; 2u], @@ -30,7 +30,7 @@ fn with_anon_struct_array() { ), quote_item!(cx, #[repr(C)] - #[deriving(Copy)] + #[derive(Copy)] pub struct Struct_Unnamed1 { pub a: ::libc::c_int, pub b: ::libc::c_int, @@ -43,7 +43,7 @@ fn with_anon_struct_array() { ), quote_item!(cx, #[repr(C)] - #[deriving(Copy)] + #[derive(Copy)] pub struct Struct_Unnamed2 { pub a: ::libc::c_int, pub b: ::libc::c_int, @@ -139,7 +139,7 @@ fn containing_fwd_decl_struct() { assert_bind_eq!("headers/struct_containing_forward_declared_struct.h", cx, quote_item!(cx, #[repr(C)] - #[deriving(Copy)] + #[derive(Copy)] pub struct Struct_a { pub val_a: *mut Struct_b, } @@ -151,7 +151,7 @@ fn containing_fwd_decl_struct() { ), quote_item!(cx, #[repr(C)] - #[deriving(Copy)] + #[derive(Copy)] pub struct Struct_b { pub val_b: ::libc::c_int, } @@ -169,7 +169,7 @@ fn with_bitfields() { assert_bind_eq!("headers/struct_with_bitfields.h", cx, quote_item!(cx, #[repr(C)] - #[deriving(Copy)] + #[derive(Copy)] pub struct Struct_bitfield { pub _bindgen_bitfield_1_: ::libc::c_ushort, pub e: ::libc::c_int, diff --git a/tests/test_union.rs b/tests/test_union.rs index 61cb7a04..af6b9fa9 100644 --- a/tests/test_union.rs +++ b/tests/test_union.rs @@ -21,14 +21,14 @@ fn with_anon_struct_bitfield() { assert_bind_eq!("headers/union_with_anon_struct_bitfield.h", cx, quote_item!(cx, #[repr(C)] - #[deriving(Copy)] + #[derive(Copy)] pub struct Union_foo { pub _bindgen_data_: [u32; 1u], } ), quote_item!(cx, impl Union_foo { - pub unsafe fn a(&self) -> *mut ::libc::c_int { + pub unsafe fn a(&mut self) -> *mut ::libc::c_int { ::std::mem::transmute(&self._bindgen_data_) } } |