Skip to content

impl Display for io::ErrorKind #93090

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

Merged
merged 1 commit into from
Feb 1, 2022
Merged

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Jan 19, 2022

This avoids having to convert from ErrorKind to Error just to print the error message.

@rust-highfive
Copy link
Contributor

r? @joshtriplett

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 19, 2022
@jyn514 jyn514 added needs-fcp This change is insta-stable, so needs a completed FCP to proceed. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jan 19, 2022
@jyn514
Copy link
Member Author

jyn514 commented Jan 19, 2022

FYI @pietroalbini I still seem to have various github permissions even after leaving the rustdoc team, you might want into look into the automation for that.

impl fmt::Display for ErrorKind {
/// Shows a human-readable description of the `ErrorKind`.
///
/// This is similar to `impl Display for Error`, but doesn't require the error to be allocated on the heap.
Copy link
Member Author

Choose a reason for hiding this comment

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

I realized after writing this that the comment is wrong and this impl is less useful than I thought, because impl From<ErrorKind> for Error doesn't allocate. But this still seems like a useful change even so to avoid noise.

This avoids having to convert from `ErrorKind` to `Error` just to print the error message.
@joshtriplett
Copy link
Member

This seems reasonable to me.

@rfcbot merge

@rfcbot
Copy link
Collaborator

rfcbot commented Jan 19, 2022

Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Jan 19, 2022
@rfcbot
Copy link
Collaborator

rfcbot commented Jan 19, 2022

🔔 This is now entering its final comment period, as per the review above. 🔔

@ChrisDenton
Copy link
Member

Aside: This makes me wonder if it might make sense to implement PartialEq<io::ErrorKind> for io::Error.

@joshtriplett
Copy link
Member

joshtriplett commented Jan 19, 2022

@ChrisDenton That seems like a great idea, and it might substantially simplify error handling code that needs to check for specific cases.

@joshtriplett joshtriplett added the relnotes Marks issues that should be documented in the release notes of the next release. label Jan 21, 2022
@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Jan 29, 2022
@rfcbot
Copy link
Collaborator

rfcbot commented Jan 29, 2022

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

@rfcbot rfcbot added the to-announce Announce this issue on triage meeting label Jan 29, 2022
@dtolnay dtolnay assigned dtolnay and unassigned joshtriplett Jan 31, 2022
@dtolnay
Copy link
Member

dtolnay commented Jan 31, 2022

@bors r+

@bors
Copy link
Collaborator

bors commented Jan 31, 2022

📌 Commit f8ee57b has been approved by dtolnay

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 31, 2022
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 31, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 31, 2022
`impl Display for io::ErrorKind`

This avoids having to convert from `ErrorKind` to `Error` just to print the error message.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 31, 2022
`impl Display for io::ErrorKind`

This avoids having to convert from `ErrorKind` to `Error` just to print the error message.
@ehuss ehuss mentioned this pull request Feb 1, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 1, 2022
Rollup of 9 pull requests

Successful merges:

 - rust-lang#91343 (Fix suggestion to slice if scrutinee is a `Result` or `Option`)
 - rust-lang#93019 (If an integer is entered with an upper-case base prefix (0Xbeef, 0O755, 0B1010), suggest to make it lowercase)
 - rust-lang#93090 (`impl Display for io::ErrorKind`)
 - rust-lang#93456 (Remove an unnecessary transmute from opaque::Encoder)
 - rust-lang#93492 (Hide failed command unless in verbose mode)
 - rust-lang#93504 (kmc-solid: Increase the default stack size)
 - rust-lang#93513 (Allow any pretty printed line to have at least 60 chars)
 - rust-lang#93532 (Update books)
 - rust-lang#93533 (Update cargo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 8604161 into rust-lang:master Feb 1, 2022
@rustbot rustbot added this to the 1.60.0 milestone Feb 1, 2022
@jyn514 jyn514 deleted the errorkind-asstr branch February 1, 2022 14:10
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Feb 1, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. needs-fcp This change is insta-stable, so needs a completed FCP to proceed. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants