-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Confusing compiler error when returning a Result<Result>
via ?
-operator
#86547
Comments
The error on nightly is a bit different now, post rust-lang/rfcs#3058
That does have the double-nest mentioned ( (It'll be a bit clearer once |
is this better, I think this should works fine and compile ok. |
the compiler is right!! try will desuger to this
will be
|
@756445638 Oops, I forgot to update that comment. Fixed with PR #86994 |
@scottmcm ok I just notice that! |
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=9aac41ba36103dac1f4ae20fa30c86f0
The current output is:
Ideally the output would mention the double-
Result
wrapping ("got typeResult<Result<...>>
expected ...") and suggest removing one layer orResult::flatten()
or similar.It kind of does the former already if you squint but it's far from obvious ("the trait
From<Result<_, &str>>
is not implemented for&str
").The text was updated successfully, but these errors were encountered: