-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add doc for impl From for Error #53517
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
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
@bors delegate=skade |
✌️ @skade can now approve this pull request |
Ping from triage @skade! This PR needs your review. |
Ping from triage @skade / @rust-lang/docs: This PR requires your review. |
src/libstd/io/error.rs
Outdated
@@ -212,6 +212,12 @@ impl ErrorKind { | |||
/// the heap (for normal construction via Error::new) is too costly. | |||
#[stable(feature = "io_error_from_errorkind", since = "1.14.0")] | |||
impl From<ErrorKind> for Error { | |||
/// Converts a [`ErrorKind`] into a [`Error`]. | |||
/// | |||
/// This conversion allocates a new error with simple repr. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
repr
? (please write the full word).
Please add an example. |
Hey, I am currently traveling, will look at this again in around 3 weeks. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@GuillaumeGomez an example was added |
Please remove |
To expand on @GuillaumeGomez 's comment, you don't need to add the https://doc.rust-lang.org/book/first-edition/documentation.html#documentation-as-tests |
Cool thanks @frewsxcv @GuillaumeGomez |
src/libstd/io/error.rs
Outdated
@@ -212,6 +212,19 @@ impl ErrorKind { | |||
/// the heap (for normal construction via Error::new) is too costly. | |||
#[stable(feature = "io_error_from_errorkind", since = "1.14.0")] | |||
impl From<ErrorKind> for Error { | |||
/// Converts a [`ErrorKind`] into a [`Error`]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just thought: shouldn't it be "an Error"?
@phungleson Hope you don't mind I pushed a small grammar change. Thanks for the docs contribution! @bors r+ rollup |
📌 Commit 4f3896d has been approved by |
@frewsxcv not at all thanks! |
☀️ Test successful - status-appveyor, status-travis |
As part of issue #51430 (cc @skade).
The impl is very simple, let me know if we need to go into any details.