diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-07-14 10:37:28 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-07-14 10:37:28 -0700 |
| commit | f4beac4a4337296ab356d69ad1ed42f68f461bf1 (patch) | |
| tree | 6f1073832a7a46e8f131e24acbae7e4c2df50345 | |
| parent | fc67dddb9bb2a32184e425ff99fc9e038c0f8dff (diff) | |
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.
| -rw-r--r-- | src/comp/middle/typeck.rs | 5 | ||||
| -rw-r--r-- | src/test/run-pass/main-int-synonym.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/main-int.rs | 1 |
3 files changed, 1 insertions, 7 deletions
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 |
