Skip to content

Commit f4beac4

Browse files
committed
Revert "Allow main to return int"
This reverts commit 8c94d8f. 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.
1 parent fc67ddd commit f4beac4

File tree

3 files changed

+1
-7
lines changed

3 files changed

+1
-7
lines changed

src/comp/middle/typeck.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2672,10 +2672,7 @@ fn check_main_fn_ty(&ty::ctxt tcx, &ast::node_id main_id) {
26722672
alt (ty::struct(tcx, main_t)) {
26732673
case (ty::ty_fn(ast::proto_fn, ?args, ?rs, ast::return, ?constrs)) {
26742674
auto ok = ivec::len(constrs) == 0u;
2675-
ok &= ty::type_is_nil(tcx, rs) || alt (ty::struct(tcx, rs)) {
2676-
ty::ty_int { true }
2677-
_ { false }
2678-
};
2675+
ok &= ty::type_is_nil(tcx, rs);
26792676
auto num_args = ivec::len(args);
26802677
ok &= num_args == 0u || (num_args == 1u &&
26812678
arg_is_argv_ty(tcx, args.(0)));

src/test/run-pass/main-int-synonym.rs

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/test/run-pass/main-int.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)