Skip to content

Commit

Permalink
Support explicit -> ()
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Jul 5, 2017
1 parent 9771b45 commit 2bcacb0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,14 @@ impl<'a> Generator<'a> {
let ret = match decl.output {
ast::FunctionRetTy::None(..) |
ast::FunctionRetTy::Default(..) => "void".to_string(),
ast::FunctionRetTy::Ty(ref t) => self.ty2name(t, false),
ast::FunctionRetTy::Ty(ref t) => {
match t.node {
ast::TyKind::Tup(ref t) if t.len() == 0 => {
"void".to_string()
}
_ => self.ty2name(t, false),
}
}
};
(ret, args, decl.variadic)
}
Expand Down
2 changes: 1 addition & 1 deletion testcrate/src/t1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ extern {
pub fn T1e(a: c_uint, b: *const T1Bar);

#[link_name = "T1f"]
pub fn f();
pub fn f() -> ();
}

0 comments on commit 2bcacb0

Please sign in to comment.