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.
This commit is contained in:
parent
fc67dddb9b
commit
f4beac4a43
@ -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)));
|
||||
|
@ -1,2 +0,0 @@
|
||||
type i = int;
|
||||
fn main() -> i { 0 }
|
@ -1 +0,0 @@
|
||||
fn main() -> int { 0 }
|
Loading…
x
Reference in New Issue
Block a user