{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/1176","repository_url":"https://api.github.com/repos/rust-lang/rfcs","labels_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1176/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1176/comments","events_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1176/events","html_url":"https://github.com/rust-lang/rfcs/issues/1176","id":90792988,"number":1176,"title":"Return `Result` from `main`","user":{"login":"Ericson2314","id":1055245,"avatar_url":"https://avatars.githubusercontent.com/u/1055245?v=3","gravatar_id":"","url":"https://api.github.com/users/Ericson2314","html_url":"https://github.com/Ericson2314","followers_url":"https://api.github.com/users/Ericson2314/followers","following_url":"https://api.github.com/users/Ericson2314/following{/other_user}","gists_url":"https://api.github.com/users/Ericson2314/gists{/gist_id}","starred_url":"https://api.github.com/users/Ericson2314/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ericson2314/subscriptions","organizations_url":"https://api.github.com/users/Ericson2314/orgs","repos_url":"https://api.github.com/users/Ericson2314/repos","events_url":"https://api.github.com/users/Ericson2314/events{/privacy}","received_events_url":"https://api.github.com/users/Ericson2314/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":59,"created_at":"2015-06-24T22:23:32Z","updated_at":"2016-05-08T10:55:15Z","closed_at":null,"body":"Rust's current error handling story is quite good for programming in the large. But for small programs, the overhead of matching the outermost `Result`, printing the error, and returning the proper error code is quite tedious in comparison to temptation of just panicking.\r\n\r\nFurthermore, interactive tools shouldn't print a message implying the program is broken on bad manual input, yet such an \"internal error\" is exactly what the panic message applies. So there is no nice, succinct way to handle input errors with bubbling results or panics.\r\n\r\nAllowing `main` to return a result would make our error handling story both compositional and succinct on programs on all sizes. Furthermore, should there be any platform-specific requirements/idioms for error-codes, etc, we can handle them transparently. While this does make `main` a bit more complex, there is already a shim between `start` and `main` with both C and Rust, so we're already down that rabbit hole.\r\n\r\nI was told by @eddyb this was already a wanted feature, but @steveklabnik didn't see an open issue so I made this."},"comment":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/comments/217709100","html_url":"https://github.com/rust-lang/rfcs/issues/1176#issuecomment-217709100","issue_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1176","id":217709100,"user":{"login":"Binero","id":6867251,"avatar_url":"https://avatars.githubusercontent.com/u/6867251?v=3","gravatar_id":"","url":"https://api.github.com/users/Binero","html_url":"https://github.com/Binero","followers_url":"https://api.github.com/users/Binero/followers","following_url":"https://api.github.com/users/Binero/following{/other_user}","gists_url":"https://api.github.com/users/Binero/gists{/gist_id}","starred_url":"https://api.github.com/users/Binero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Binero/subscriptions","organizations_url":"https://api.github.com/users/Binero/orgs","repos_url":"https://api.github.com/users/Binero/repos","events_url":"https://api.github.com/users/Binero/events{/privacy}","received_events_url":"https://api.github.com/users/Binero/received_events","type":"User","site_admin":false},"created_at":"2016-05-08T10:55:15Z","updated_at":"2016-05-08T10:55:15Z","body":"I just don't think the `-> i32` should be hard-set in the language. What if someone wanted to make a platform which wants another type, like a u32? "}}