Skip to content

Commit f19d04f

Browse files
Rollup merge of rust-lang#155848 - bushrat011899:revert_08bd077, r=Mark-Simulacrum
[doc]: Revert `core::io::ErrorKind` doc changes ACP: rust-lang/libs-team#755 Tracking issue: rust-lang#154046 Related: rust-lang#154654 ## Description rust-lang#154654 changed the documentation for `ErrorKind` to remove links to `std` items. These changes were made falsely assuming documentation links from `core` to `std` were not possible. Since it is possible, we can restore the documentation to its original form prior to the `core::io` move. ## Notes * No AI tooling of any kind was used in the creation of this PR.
2 parents 1d72d7e + 2aeb041 commit f19d04f

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

library/core/src/io/error.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ pub type RawOsError = cfg_select! {
2121
/// This list is intended to grow over time and it is not recommended to
2222
/// exhaustively match against it.
2323
///
24+
/// It is used with the [`io::Error`][error] type.
25+
///
26+
/// [error]: ../../std/io/struct.Error.html
27+
///
2428
/// # Handling errors and matching on `ErrorKind`
2529
///
2630
/// In application code, use `match` for the `ErrorKind` values you are
@@ -135,12 +139,13 @@ pub enum ErrorKind {
135139
#[stable(feature = "rust1", since = "1.0.0")]
136140
TimedOut,
137141
/// An error returned when an operation could not be completed because a
138-
/// call to an underlying writer returned [`Ok(0)`].
142+
/// call to [`write`][write] returned [`Ok(0)`].
139143
///
140144
/// This typically means that an operation could only succeed if it wrote a
141145
/// particular number of bytes but only a smaller number of bytes could be
142146
/// written.
143147
///
148+
/// [write]: ../../std/io/trait.Write.html#tymethod.write
144149
/// [`Ok(0)`]: Ok
145150
#[stable(feature = "rust1", since = "1.0.0")]
146151
WriteZero,
@@ -239,14 +244,16 @@ pub enum ErrorKind {
239244
//
240245
/// A custom error that does not fall under any other I/O error kind.
241246
///
242-
/// This can be used to construct your own errors that do not match any
247+
/// This can be used to construct your own [`Error`][error]s that do not match any
243248
/// [`ErrorKind`].
244249
///
245250
/// This [`ErrorKind`] is not used by the standard library.
246251
///
247252
/// Errors from the standard library that do not fall under any of the I/O
248253
/// error kinds cannot be `match`ed on, and will only match a wildcard (`_`) pattern.
249254
/// New [`ErrorKind`]s might be added in the future for some of those.
255+
///
256+
/// [error]: ../../std/io/struct.Error.html
250257
#[stable(feature = "rust1", since = "1.0.0")]
251258
Other,
252259

@@ -379,7 +386,15 @@ impl ErrorKind {
379386

380387
#[stable(feature = "io_errorkind_display", since = "1.60.0")]
381388
impl fmt::Display for ErrorKind {
382-
/// Shows a human-readable description of the `ErrorKind`.
389+
/// Shows a human-readable description of the [`ErrorKind`].
390+
///
391+
/// This is similar to `impl Display for Error`, but doesn't require first converting to Error.
392+
///
393+
/// # Examples
394+
/// ```
395+
/// use core::io::ErrorKind;
396+
/// assert_eq!("entity not found", ErrorKind::NotFound.to_string());
397+
/// ```
383398
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
384399
fmt.write_str(self.as_str())
385400
}

0 commit comments

Comments
 (0)