summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gen.rs14
-rw-r--r--tests/test_func.rs4
2 files changed, 7 insertions, 11 deletions
diff --git a/src/gen.rs b/src/gen.rs
index c49cd0d5..7c2d1c9e 100644
--- a/src/gen.rs
+++ b/src/gen.rs
@@ -889,14 +889,10 @@ fn cfuncty_to_rs(ctx: &mut GenCtx,
aty: &[(String, Type)],
var: bool) -> ast::FnDecl {
- let ret = P(match *rty {
- TVoid => ast::Ty {
- id: ast::DUMMY_NODE_ID,
- node: ast::TyTup(vec![]),
- span: ctx.span
- },
- _ => cty_to_rs(ctx, rty)
- });
+ let ret = match *rty {
+ TVoid => ast::DefaultReturn(ctx.span),
+ _ => ast::Return(P(cty_to_rs(ctx, rty)))
+ };
let mut unnamed: usize = 0;
let args: Vec<ast::Arg> = aty.iter().map(|arg| {
@@ -937,7 +933,7 @@ fn cfuncty_to_rs(ctx: &mut GenCtx,
let var = !args.is_empty() && var;
return ast::FnDecl {
inputs: args,
- output: ast::Return(ret),
+ output: ret,
variadic: var
};
}
diff --git a/tests/test_func.rs b/tests/test_func.rs
index 6f809a38..996808be 100644
--- a/tests/test_func.rs
+++ b/tests/test_func.rs
@@ -43,7 +43,7 @@ fn func_proto() {
fn with_func_ptr_arg() {
assert_bind_eq("headers/func_with_func_ptr_arg.h", "
extern \"C\" {
- pub fn foo(bar: ::std::option::Option<extern \"C\" fn() -> () >) -> ();
+ pub fn foo(bar: ::std::option::Option<extern \"C\" fn()>);
}
");
}
@@ -52,7 +52,7 @@ fn with_func_ptr_arg() {
fn with_array_arg() {
assert_bind_eq("headers/func_with_array_arg.h", "
extern \"C\" {
- pub fn f(x: *mut ::libc::c_int) -> ();
+ pub fn f(x: *mut ::libc::c_int);
}
");
}