Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add a special-cased error message for returning a Result from main, to indicate improper try! usage #29605

Closed
bstrie opened this issue Nov 5, 2015 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@bstrie
Copy link
Contributor

bstrie commented Nov 5, 2015

To beginners it's surprising that try! can only be used within a function with a Result return type, which in particular means it cannot be used from main. In the past we've mulled over language-level support for solving this problem but ultimately maybe we just need a better error message. How hard would it be to just detect try! being called from within main and give a nice and specific error message?

@bstrie bstrie added the A-diagnostics Area: Messages for errors, warnings, and lints label Nov 5, 2015
@steveklabnik
Copy link
Member

This is a duplicate of #27112

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

No branches or pull requests

2 participants