Skip to content
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

The ? Operator Can be used in functions that return Option (not just Result) #2173

Closed
ultrasaurus opened this issue Nov 25, 2019 · 2 comments

Comments

@ultrasaurus
Copy link

? can be used for Option or Result since 1.22 (see blog post)

Documentation in the book says "The ? Operator Can Only Be Used in Functions That Return Result" -- see https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html#recoverable-errors-with-result

the text of this section doesn't match the current capabilities of Rust, or but the displayed error message is correct (maybe the example errors are auto-generated):
image

eddyp added a commit to upstreaming/trpl-book that referenced this issue Nov 25, 2019
Signed-off-by: Eddy Petrișor <eddy.petrisor@gmail.com>
@LeSeulArtichaut
Copy link

This has been adressed in #2047, I guess?

@ultrasaurus
Copy link
Author

Looks good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants