Uh oh!
There was an error while loading. Please reload this page.
Clarify/fix formatting docs concerning fmt::Result/fmt::Error - #35862
Conversation
rust-highfive
commented
Aug 20, 2016
(rust_highfive has picked a reviewer for you, use r? to override) |
Stebalien
commented
Aug 20, 2016
briansmith
commented
Aug 20, 2016
This kind of documentation is an indication that the API is designed wrongly. In particular, the user of the thing that implements In some cases, the implementation of |
Stebalien
commented
Aug 20, 2016
@briansmith I agree it's not ideal but it's stable...
That's how it works currently. The point of the result is to tell caller that an error has occurred and that it should stop formatting. The actual error is stashed elsewhere. For example: implDisplayforSomething{fnfmt(&self,f:&mutFormatter) -> fmt::Result{Display::fmt(&self.message, f)?;// bail early on errorDisplay::fmt(&":", f)?;// bail early on errorDisplay::fmt(&self.detail, f)?;}}
If it's a bug (programmer error or variant violation), it should panic; that's the point of panic. However, if your Also, in this case, the error will just be dropped on the floor in trait implementations like |
Doing otherwise would break traits like `ToString`.
Stebalien
commented
Aug 20, 2016
@briansmith is the updated documentation clear now? |
Yes, it is clearer. You might clarify it further by saying more of what you said in your comment above: "If any other kind of error could occur, that is a sign that |
Stebalien
commented
Aug 20, 2016
@briansmith now that I actually pushed the change I was asking about... any better? |
briansmith
commented
Aug 20, 2016
Yes, it's clearer. |
GuillaumeGomez
commented
Aug 22, 2016
👍 |
They're the same thing but it's better to keep the terminology consistent.
steveklabnik
commented
Aug 25, 2016
@bors: r+ rollup |
bors
commented
Aug 25, 2016
📌 Commit c7d5f7e has been approved by |
Clarify/fix formatting docs concerning fmt::Result/fmt::Error 1. `fmt::Result` != `io::Result<()>` 2. Formatters should only propagate errors, not return their own. Confusion on reddit: https://www.reddit.com/r/rust/comments/4yorxr/is_implt_tostring_for_t_where_t_display_sized_a/
Clarify/fix formatting docs concerning fmt::Result/fmt::Error 1. `fmt::Result` != `io::Result<()>` 2. Formatters should only propagate errors, not return their own. Confusion on reddit: https://www.reddit.com/r/rust/comments/4yorxr/is_implt_tostring_for_t_where_t_display_sized_a/
Clarify/fix formatting docs concerning fmt::Result/fmt::Error 1. `fmt::Result` != `io::Result<()>` 2. Formatters should only propagate errors, not return their own. Confusion on reddit: https://www.reddit.com/r/rust/comments/4yorxr/is_implt_tostring_for_t_where_t_display_sized_a/
Clarify/fix formatting docs concerning fmt::Result/fmt::Error 1. `fmt::Result` != `io::Result<()>` 2. Formatters should only propagate errors, not return their own. Confusion on reddit: https://www.reddit.com/r/rust/comments/4yorxr/is_implt_tostring_for_t_where_t_display_sized_a/
bors
commented
Aug 29, 2016
⌛ Testing commit c7d5f7e with merge d62f786... |
bors
commented
Aug 29, 2016
💔 Test failed - auto-mac-64-opt-rustbuild |
arielb1
commented
Aug 29, 2016
@bors retry |
Clarify/fix formatting docs concerning fmt::Result/fmt::Error 1. `fmt::Result` != `io::Result<()>` 2. Formatters should only propagate errors, not return their own. Confusion on reddit: https://www.reddit.com/r/rust/comments/4yorxr/is_implt_tostring_for_t_where_t_display_sized_a/
Clarify/fix formatting docs concerning fmt::Result/fmt::Error 1. `fmt::Result` != `io::Result<()>` 2. Formatters should only propagate errors, not return their own. Confusion on reddit: https://www.reddit.com/r/rust/comments/4yorxr/is_implt_tostring_for_t_where_t_display_sized_a/
Clarify/fix formatting docs concerning fmt::Result/fmt::Error 1. `fmt::Result` != `io::Result<()>` 2. Formatters should only propagate errors, not return their own. Confusion on reddit: https://www.reddit.com/r/rust/comments/4yorxr/is_implt_tostring_for_t_where_t_display_sized_a/
fmt::Result!=io::Result<()>Confusion on reddit: https://www.reddit.com/r/rust/comments/4yorxr/is_implt_tostring_for_t_where_t_display_sized_a/