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
{{ message }}
This repository has been archived by the owner on Oct 30, 2019. It is now read-only.
error[E0271]: type mismatch resolving `<impl std::future::Future as std::future::Future>::Output == std::result::Result<(), std::io::Error>`
--> src/main.rs:4:20
|
4 | async fn main() -> std::io::Result<()> {
| ^^^^^^^^^^^^^^^^^^^ expected (), found enum `std::result::Result`
|
= note: expected type `()`
found type `std::result::Result<(), std::io::Error>`
= note: the return type of a function must have a statically known size
This is backwards to the error generated with a non-async main for the same code
error[E0308]: mismatched types
--> src/main.rs:1:14
|
1 | fn main() -> std::io::Result<()> {
| ^^^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found ()
|
= note: expected type `std::result::Result<(), std::io::Error>`
found type `()`
forcing an intermediate type check of the implicit return (this won't fix cases where the code does an early return of the wrong type, but it will fix the relatively common forgetting of Ok(()) at the end of error returning functions).
The text was updated successfully, but these errors were encountered:
@Nemo157 oh yeah, I've run into this at least once before. I'd be very 👍 on a patch (if you'd like to submit one). Though #73 is also working on this exact code right now, and maybe we could merge it into that patchset.
Using this example
the error message is
This is backwards to the error generated with a non-
async
main for the same codeThe current expansion is approximately
this runs into rust-lang/rust#54326, as a workaround till that is fixed the expansion could be changed to something like
forcing an intermediate type check of the implicit return (this won't fix cases where the code does an early return of the wrong type, but it will fix the relatively common forgetting of
Ok(())
at the end of error returning functions).The text was updated successfully, but these errors were encountered: