Skip to content

Commit 9579a08

Browse files
committed
Rollup merge of #30546 - tshepang:add-links, r=steveklabnik
2 parents 8e98120 + a4da9ac commit 9579a08

File tree

1 file changed

+36
-15
lines changed

1 file changed

+36
-15
lines changed

src/libstd/io/stdio.rs

+36-15
Original file line numberDiff line numberDiff line change
@@ -133,23 +133,30 @@ fn handle_ebadf<T>(r: io::Result<T>, default: T) -> io::Result<T> {
133133
/// A handle to the standard input stream of a process.
134134
///
135135
/// Each handle is a shared reference to a global buffer of input data to this
136-
/// process. A handle can be `lock`'d to gain full access to `BufRead` methods
136+
/// process. A handle can be `lock`'d to gain full access to [`BufRead`] methods
137137
/// (e.g. `.lines()`). Writes to this handle are otherwise locked with respect
138138
/// to other writes.
139139
///
140140
/// This handle implements the `Read` trait, but beware that concurrent reads
141141
/// of `Stdin` must be executed with care.
142142
///
143-
/// Created by the function `io::stdin()`.
143+
/// Created by the [`io::stdin`] method.
144+
///
145+
/// [`io::stdin`]: fn.stdin.html
146+
/// [`BufRead`]: trait.BufRead.html
144147
#[stable(feature = "rust1", since = "1.0.0")]
145148
pub struct Stdin {
146149
inner: Arc<Mutex<BufReader<Maybe<StdinRaw>>>>,
147150
}
148151

149152
/// A locked reference to the `Stdin` handle.
150153
///
151-
/// This handle implements both the `Read` and `BufRead` traits and is
152-
/// constructed via the `lock` method on `Stdin`.
154+
/// This handle implements both the [`Read`] and [`BufRead`] traits, and
155+
/// is constructed via the [`Stdin::lock`] method.
156+
///
157+
/// [`Read`]: trait.Read.html
158+
/// [`BufRead`]: trait.BufRead.html
159+
/// [`Stdin::lock`]: struct.Stdin.html#method.lock
153160
#[stable(feature = "rust1", since = "1.0.0")]
154161
pub struct StdinLock<'a> {
155162
inner: MutexGuard<'a, BufReader<Maybe<StdinRaw>>>,
@@ -159,7 +166,7 @@ pub struct StdinLock<'a> {
159166
///
160167
/// Each handle returned is a reference to a shared global buffer whose access
161168
/// is synchronized via a mutex. If you need more explicit control over
162-
/// locking, see the [lock() method][lock].
169+
/// locking, see the [`lock() method`][lock].
163170
///
164171
/// [lock]: struct.Stdin.html#method.lock
165172
///
@@ -221,8 +228,11 @@ impl Stdin {
221228
/// guard.
222229
///
223230
/// The lock is released when the returned lock goes out of scope. The
224-
/// returned guard also implements the `Read` and `BufRead` traits for
231+
/// returned guard also implements the [`Read`] and [`BufRead`] traits for
225232
/// accessing the underlying data.
233+
///
234+
/// [Read]: trait.Read.html
235+
/// [BufRead]: trait.BufRead.html
226236
#[stable(feature = "rust1", since = "1.0.0")]
227237
pub fn lock(&self) -> StdinLock {
228238
StdinLock { inner: self.inner.lock().unwrap_or_else(|e| e.into_inner()) }
@@ -231,7 +241,9 @@ impl Stdin {
231241
/// Locks this handle and reads a line of input into the specified buffer.
232242
///
233243
/// For detailed semantics of this method, see the documentation on
234-
/// `BufRead::read_line`.
244+
/// [`BufRead::read_line`].
245+
///
246+
/// [`BufRead::read_line`]: trait.BufRead.html#method.read_line
235247
///
236248
/// # Examples
237249
///
@@ -314,7 +326,9 @@ const OUT_MAX: usize = ::usize::MAX;
314326
/// output stream. Access is also synchronized via a lock and explicit control
315327
/// over locking is available via the `lock` method.
316328
///
317-
/// Created by the function `io::stdout()`.
329+
/// Created by the [`io::stdout`] method.
330+
///
331+
/// [`io::stdout`]: fn.stdout.html
318332
#[stable(feature = "rust1", since = "1.0.0")]
319333
pub struct Stdout {
320334
// FIXME: this should be LineWriter or BufWriter depending on the state of
@@ -325,8 +339,11 @@ pub struct Stdout {
325339

326340
/// A locked reference to the `Stdout` handle.
327341
///
328-
/// This handle implements the `Write` trait and is constructed via the `lock`
329-
/// method on `Stdout`.
342+
/// This handle implements the [`Write`] trait, and is constructed via
343+
/// the [`Stdout::lock`] method.
344+
///
345+
/// [`Write`]: trait.Write.html
346+
/// [`Stdout::lock`]: struct.Stdout.html#method.lock
330347
#[stable(feature = "rust1", since = "1.0.0")]
331348
pub struct StdoutLock<'a> {
332349
inner: ReentrantMutexGuard<'a, RefCell<LineWriter<Maybe<StdoutRaw>>>>,
@@ -336,9 +353,9 @@ pub struct StdoutLock<'a> {
336353
///
337354
/// Each handle returned is a reference to a shared global buffer whose access
338355
/// is synchronized via a mutex. If you need more explicit control over
339-
/// locking, see the [lock() method][lock].
356+
/// locking, see the [Stdout::lock] method.
340357
///
341-
/// [lock]: struct.Stdout.html#method.lock
358+
/// [Stdout::lock]: struct.Stdout.html#method.lock
342359
///
343360
/// # Examples
344361
///
@@ -424,16 +441,20 @@ impl<'a> Write for StdoutLock<'a> {
424441

425442
/// A handle to the standard error stream of a process.
426443
///
427-
/// For more information, see `stderr`
444+
/// For more information, see the [`io::stderr`] method.
445+
///
446+
/// [`io::stderr`]: fn.stderr.html
428447
#[stable(feature = "rust1", since = "1.0.0")]
429448
pub struct Stderr {
430449
inner: Arc<ReentrantMutex<RefCell<Maybe<StderrRaw>>>>,
431450
}
432451

433452
/// A locked reference to the `Stderr` handle.
434453
///
435-
/// This handle implements the `Write` trait and is constructed via the `lock`
436-
/// method on `Stderr`.
454+
/// This handle implements the `Write` trait and is constructed via
455+
/// the [`Stderr::lock`] method.
456+
///
457+
/// [`Stderr::lock`]: struct.Stderr.html#method.lock
437458
#[stable(feature = "rust1", since = "1.0.0")]
438459
pub struct StderrLock<'a> {
439460
inner: ReentrantMutexGuard<'a, RefCell<Maybe<StderrRaw>>>,

0 commit comments

Comments
 (0)