From f4beac4a4337296ab356d69ad1ed42f68f461bf1 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 14 Jul 2011 10:37:28 -0700 Subject: [PATCH] Revert "Allow main to return int" This reverts commit 8c94d8fd54ba864e6a603ba6d90d41ccfaa62f53. 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. --- src/comp/middle/typeck.rs | 5 +---- src/test/run-pass/main-int-synonym.rs | 2 -- src/test/run-pass/main-int.rs | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) delete mode 100644 src/test/run-pass/main-int-synonym.rs delete mode 100644 src/test/run-pass/main-int.rs diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index 8c5d2633767..8d28e1e53a4 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -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))); diff --git a/src/test/run-pass/main-int-synonym.rs b/src/test/run-pass/main-int-synonym.rs deleted file mode 100644 index 9dbd64f1b75..00000000000 --- a/src/test/run-pass/main-int-synonym.rs +++ /dev/null @@ -1,2 +0,0 @@ -type i = int; -fn main() -> i { 0 } \ No newline at end of file diff --git a/src/test/run-pass/main-int.rs b/src/test/run-pass/main-int.rs deleted file mode 100644 index 0bc138192a9..00000000000 --- a/src/test/run-pass/main-int.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() -> int { 0 } \ No newline at end of file