You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I, like many other rust beginners, hit the "no try! in main problem". I'm not saying it should be fixed, but the error message should be more helpful. Could it explictly mention the fact this is to do with return values? It is currently:
--> test.rs:13:5
|
13 | try!(io::stdin().read_line(&mut guess));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found enum `std::result::Result`
|
= note: expected type `()`
found type `std::result::Result<_, _>`
= help: here are some functions which might fulfill your needs:
- .unwrap()
- .unwrap_err()
- .unwrap_or_default()
= note: this error originates in a macro outside of the current crate
Perhaps the error could change to something like: return type of main is (), trying to return enum std::result::Result (obviously don't hard-wire for main). This makes it more clear why we expected ().
I suspected this would already be reported somewhere, but I can't find it.
The text was updated successfully, but these errors were encountered:
This is a duplicate of #35946 and many other linked issues. We agree it's a big deal! I'm going to close it so we can keep discussion all in one place, thanks.
I, like many other rust beginners, hit the "no
try!
inmain
problem". I'm not saying it should be fixed, but the error message should be more helpful. Could it explictly mention the fact this is to do with return values? It is currently:Perhaps the error could change to something like:
return type of main is (), trying to return enum std::result::Result
(obviously don't hard-wire for main). This makes it more clear why weexpected ()
.I suspected this would already be reported somewhere, but I can't find it.
The text was updated successfully, but these errors were encountered: