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

Document try!'s error conversion behaviour #36099

Merged
merged 1 commit into from
Sep 3, 2016

Conversation

skade
Copy link
Contributor

@skade skade commented Aug 29, 2016

try!'s documentation currently doesn't document the error conversion behaviour of the macro. This patch extends the documentation.

Open questions:

  • is it worthwhile to have seperate examples with and without wrapping behaviour? It's not immediately obvious that From for T is always defined. Though this is necessary for the macro to work in any case, is this the place to expect that knowledge.

@rust-highfive
Copy link
Collaborator

r? @aturon

(rust_highfive has picked a reviewer for you, use r? to override)

/// it provides.
/// error if the value of the expression is `Err`. It additionally provides
/// automatic conversions of errors into other errors using `From`.
/// Can only be used in functions that return `Result` because of the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Can/It can/

@steveklabnik steveklabnik assigned steveklabnik and unassigned aturon Aug 29, 2016
/// Can only be used in functions that return `Result` because of the
/// early return of `Err` that it provides.
///
/// `try!` unwraps the given `Result` and, in case of an `Ok` variant, the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"unwrap" is an unfortunate choice of words here, since unwrap() is a method, and it doesn't use it

@skade skade force-pushed the better-try-documentation branch from ac71520 to 33ba3df Compare August 29, 2016 17:54
@skade
Copy link
Contributor Author

skade commented Aug 29, 2016

Fixed all comments.

@skade skade force-pushed the better-try-documentation branch from 33ba3df to dea3179 Compare August 29, 2016 18:06
@skade skade force-pushed the better-try-documentation branch from dea3179 to 0f8eb81 Compare September 1, 2016 17:17
@skade
Copy link
Contributor Author

skade commented Sep 1, 2016

@steveklabnik updated. Made it more concise (hopefully) and direct.

@steveklabnik
Copy link
Member

I'm into it. Build failure looks spurious. Thanks!

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Sep 1, 2016

📌 Commit 0f8eb81 has been approved by steveklabnik

sophiajt pushed a commit to sophiajt/rust that referenced this pull request Sep 2, 2016
…teveklabnik

Document try!'s error conversion behaviour

try!'s documentation currently doesn't document the error conversion behaviour of the macro. This patch extends the documentation.

Open questions:
* is it worthwhile to have seperate examples with and without wrapping behaviour? It's not immediately obvious that From<T> for T is always defined. Though this is necessary for the macro to work in any case, is this the place to expect that knowledge.
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Sep 2, 2016
…teveklabnik

Document try!'s error conversion behaviour

try!'s documentation currently doesn't document the error conversion behaviour of the macro. This patch extends the documentation.

Open questions:
* is it worthwhile to have seperate examples with and without wrapping behaviour? It's not immediately obvious that From<T> for T is always defined. Though this is necessary for the macro to work in any case, is this the place to expect that knowledge.
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Sep 2, 2016
…teveklabnik

Document try!'s error conversion behaviour

try!'s documentation currently doesn't document the error conversion behaviour of the macro. This patch extends the documentation.

Open questions:
* is it worthwhile to have seperate examples with and without wrapping behaviour? It's not immediately obvious that From<T> for T is always defined. Though this is necessary for the macro to work in any case, is this the place to expect that knowledge.
bors added a commit that referenced this pull request Sep 3, 2016
Rollup of 12 pull requests

- Successful merges: #35754, #35793, #36099, #36160, #36171, #36178, #36180, #36190, #36198, #36205, #36210, #36223
- Failed merges:
@bors bors merged commit 0f8eb81 into rust-lang:master Sep 3, 2016
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

Successfully merging this pull request may close these issues.

6 participants