@@ -4,8 +4,7 @@ use crate::fmt;
44use crate :: result;
55use crate :: sys;
66
7- /// A specialized [`Result`](../result/enum.Result.html) type for I/O
8- /// operations.
7+ /// A specialized [`Result`] type for I/O operations.
98///
109/// This type is broadly used across [`std::io`] for any operation which may
1110/// produce an error.
@@ -16,12 +15,13 @@ use crate::sys;
1615/// While usual Rust style is to import types directly, aliases of [`Result`]
1716/// often are not, to make it easier to distinguish between them. [`Result`] is
1817/// generally assumed to be [`std::result::Result`][`Result`], and so users of this alias
19- /// will generally use `io::Result` instead of shadowing the prelude's import
18+ /// will generally use `io::Result` instead of shadowing the [ prelude] 's import
2019/// of [`std::result::Result`][`Result`].
2120///
22- /// [`std::io`]: ../io/index.html
23- /// [`io::Error`]: ../io/struct.Error.html
24- /// [`Result`]: ../result/enum.Result.html
21+ /// [`std::io`]: crate::io
22+ /// [`io::Error`]: Error
23+ /// [`Result`]: crate::result::Result
24+ /// [prelude]: crate::prelude
2525///
2626/// # Examples
2727///
@@ -48,10 +48,9 @@ pub type Result<T> = result::Result<T, Error>;
4848/// `Error` can be created with crafted error messages and a particular value of
4949/// [`ErrorKind`].
5050///
51- /// [`Read`]: ../io/trait.Read.html
52- /// [`Write`]: ../io/trait.Write.html
53- /// [`Seek`]: ../io/trait.Seek.html
54- /// [`ErrorKind`]: enum.ErrorKind.html
51+ /// [`Read`]: crate::io::Read
52+ /// [`Write`]: crate::io::Write
53+ /// [`Seek`]: crate::io::Seek
5554#[ stable( feature = "rust1" , since = "1.0.0" ) ]
5655pub struct Error {
5756 repr : Repr ,
@@ -83,7 +82,7 @@ struct Custom {
8382///
8483/// It is used with the [`io::Error`] type.
8584///
86- /// [`io::Error`]: struct. Error.html
85+ /// [`io::Error`]: Error
8786#[ derive( Clone , Copy , Debug , Eq , Hash , Ord , PartialEq , PartialOrd ) ]
8887#[ stable( feature = "rust1" , since = "1.0.0" ) ]
8988#[ allow( deprecated) ]
@@ -137,7 +136,7 @@ pub enum ErrorKind {
137136 /// For example, a function that reads a file into a string will error with
138137 /// `InvalidData` if the file's contents are not valid UTF-8.
139138 ///
140- /// [`InvalidInput`]: #variant. InvalidInput
139+ /// [`InvalidInput`]: ErrorKind:: InvalidInput
141140 #[ stable( feature = "io_invalid_data" , since = "1.2.0" ) ]
142141 InvalidData ,
143142 /// The I/O operation's timeout expired, causing it to be canceled.
@@ -150,8 +149,8 @@ pub enum ErrorKind {
150149 /// particular number of bytes but only a smaller number of bytes could be
151150 /// written.
152151 ///
153- /// [`write`]: ../../std/io/trait. Write.html#tymethod. write
154- /// [`Ok(0)`]: ../../std/io/type.Result.html
152+ /// [`write`]: crate::io:: Write:: write
153+ /// [`Ok(0)`]: Ok
155154 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
156155 WriteZero ,
157156 /// This operation was interrupted.
@@ -220,9 +219,6 @@ impl From<ErrorKind> for Error {
220219 /// let error = Error::from(not_found);
221220 /// assert_eq!("entity not found", format!("{}", error));
222221 /// ```
223- ///
224- /// [`ErrorKind`]: ../../std/io/enum.ErrorKind.html
225- /// [`Error`]: ../../std/io/struct.Error.html
226222 #[ inline]
227223 fn from ( kind : ErrorKind ) -> Error {
228224 Error { repr : Repr :: Simple ( kind) }
@@ -235,7 +231,7 @@ impl Error {
235231 ///
236232 /// This function is used to generically create I/O errors which do not
237233 /// originate from the OS itself. The `error` argument is an arbitrary
238- /// payload which will be contained in this `Error`.
234+ /// payload which will be contained in this [ `Error`] .
239235 ///
240236 /// # Examples
241237 ///
@@ -264,7 +260,7 @@ impl Error {
264260 ///
265261 /// This function reads the value of `errno` for the target platform (e.g.
266262 /// `GetLastError` on Windows) and will return a corresponding instance of
267- /// `Error` for the error code.
263+ /// [ `Error`] for the error code.
268264 ///
269265 /// # Examples
270266 ///
@@ -278,7 +274,7 @@ impl Error {
278274 Error :: from_raw_os_error ( sys:: os:: errno ( ) as i32 )
279275 }
280276
281- /// Creates a new instance of an `Error` from a particular OS error code.
277+ /// Creates a new instance of an [ `Error`] from a particular OS error code.
282278 ///
283279 /// # Examples
284280 ///
@@ -310,9 +306,12 @@ impl Error {
310306
311307 /// Returns the OS error that this error represents (if any).
312308 ///
313- /// If this `Error` was constructed via `last_os_error` or
314- /// `from_raw_os_error`, then this function will return `Some`, otherwise
315- /// it will return `None`.
309+ /// If this [`Error`] was constructed via [`last_os_error`] or
310+ /// [`from_raw_os_error`], then this function will return [`Some`], otherwise
311+ /// it will return [`None`].
312+ ///
313+ /// [`last_os_error`]: Error::last_os_error
314+ /// [`from_raw_os_error`]: Error::from_raw_os_error
316315 ///
317316 /// # Examples
318317 ///
@@ -345,8 +344,10 @@ impl Error {
345344
346345 /// Returns a reference to the inner error wrapped by this error (if any).
347346 ///
348- /// If this `Error` was constructed via `new` then this function will
349- /// return `Some`, otherwise it will return `None`.
347+ /// If this [`Error`] was constructed via [`new`] then this function will
348+ /// return [`Some`], otherwise it will return [`None`].
349+ ///
350+ /// [`new`]: Error::new
350351 ///
351352 /// # Examples
352353 ///
@@ -380,8 +381,10 @@ impl Error {
380381 /// Returns a mutable reference to the inner error wrapped by this error
381382 /// (if any).
382383 ///
383- /// If this `Error` was constructed via `new` then this function will
384- /// return `Some`, otherwise it will return `None`.
384+ /// If this [`Error`] was constructed via [`new`] then this function will
385+ /// return [`Some`], otherwise it will return [`None`].
386+ ///
387+ /// [`new`]: Error::new
385388 ///
386389 /// # Examples
387390 ///
@@ -448,8 +451,10 @@ impl Error {
448451
449452 /// Consumes the `Error`, returning its inner error (if any).
450453 ///
451- /// If this `Error` was constructed via `new` then this function will
452- /// return `Some`, otherwise it will return `None`.
454+ /// If this [`Error`] was constructed via [`new`] then this function will
455+ /// return [`Some`], otherwise it will return [`None`].
456+ ///
457+ /// [`new`]: Error::new
453458 ///
454459 /// # Examples
455460 ///
@@ -480,7 +485,7 @@ impl Error {
480485 }
481486 }
482487
483- /// Returns the corresponding `ErrorKind` for this error.
488+ /// Returns the corresponding [ `ErrorKind`] for this error.
484489 ///
485490 /// # Examples
486491 ///
0 commit comments