Revert "Allow main to return int"

This reverts commit 8c94d8fd54.

There's no mechanism to actually return the value from main, so all this does
is allow main -> int to compile. Per #688, the program returns non-zero on
failure, so it's not obvious that this change is appropriate at this time.
This commit is contained in:
Brian Anderson 2011-07-14 10:37:28 -07:00
parent fc67dddb9b
commit f4beac4a43
3 changed files with 1 additions and 7 deletions

View File

@ -2672,10 +2672,7 @@ fn check_main_fn_ty(&ty::ctxt tcx, &ast::node_id main_id) {
alt (ty::struct(tcx, main_t)) {
case (ty::ty_fn(ast::proto_fn, ?args, ?rs, ast::return, ?constrs)) {
auto ok = ivec::len(constrs) == 0u;
ok &= ty::type_is_nil(tcx, rs) || alt (ty::struct(tcx, rs)) {
ty::ty_int { true }
_ { false }
};
ok &= ty::type_is_nil(tcx, rs);
auto num_args = ivec::len(args);
ok &= num_args == 0u || (num_args == 1u &&
arg_is_argv_ty(tcx, args.(0)));

View File

@ -1,2 +0,0 @@
type i = int;
fn main() -> i { 0 }

View File

@ -1 +0,0 @@
fn main() -> int { 0 }