-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Code only compiles with try!, not with question mark syntax #36244
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
Comments
This is a known issue and has to to do with how the Carrier trait currently works. There's an old discussion at #35056 which should be continued at rust-lang/rfcs#1718. |
@Stebalien thanks! Wasn't aware of the already existing discussion. |
This compiles today; closing. |
I think this issue may need to be re-opened. I ran into it today ( https://play.rust-lang.org/?gist=f12d5c5166d268479961bcbb2eccbd50&version=nightly
|
Current output for the last comment:
It should work without annotations, but at least we lead people in the right direction :-/ |
Current output of that link:
|
The following code only compiles with
try!
, not when using the?
-syntax instead:Replacing the single
try!
in functionfoo
with its?
equivalent produces the following error:Example on playground: https://is.gd/CPUV0f (replace
try!
with?
to see the error)Rustc version: rustc 1.13.0-nightly (acd3f79 2016-08-28)
Note: @KiChjang mentioned on IRC that using turbofish on the collect call,
.collect::<Result<_,_>>()
, makes the?
version compile again.The text was updated successfully, but these errors were encountered: