From 5cf6253da15019e4d41bd8ff5189d15d32101058 Mon Sep 17 00:00:00 2001 From: Chris Buchholz Date: Mon, 14 Dec 2015 18:42:24 +0100 Subject: make scan() usage more explanatory --- src/libcore/iter.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index f063c6b0676..4baeec9f754 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -1113,16 +1113,22 @@ pub trait Iterator { Take{iter: self, n: n} } - /// An iterator similar to `fold()`, with internal state. - /// - /// `scan()` accumulates a final value, similar to [`fold()`], but instead - /// of passing along an accumulator, it maintains the accumulator internally. + /// An iterator adaptor similar to [`fold()`] but different because it holds + /// internal state and produces a new iterator. /// /// [`fold()`]: #method.fold /// - /// On each iteraton of `scan()`, you can assign to the internal state, and - /// a mutable reference to the state is passed as the first argument to the - /// closure, allowing you to modify it on each iteration. + /// `scan()` takes two arguments: an initial value which seeds the internal + /// state, and a closure with two arguments, the first being a mutable + /// reference to the internal state and the second an iterator element. + /// The closure can assign to the internal state to share state between + /// iterations. + /// + /// On iteration, the closure will be applied to each element of the + /// iterator and the return value from the closure, an [`Option`], is + /// yielded by the iterator. + /// + /// [`Option`]: ../option/enum.Option.html /// /// # Examples /// -- cgit 1.4.1-3-g733a5 From 5538c6b19837a418e73aebda6ad18ae90d52b8d7 Mon Sep 17 00:00:00 2001 From: Christoffer Buchholz Date: Tue, 15 Dec 2015 08:49:57 +0100 Subject: Clearer leading sentence --- src/libcore/iter.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 4baeec9f754..338305ac6d8 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -1113,8 +1113,8 @@ pub trait Iterator { Take{iter: self, n: n} } - /// An iterator adaptor similar to [`fold()`] but different because it holds - /// internal state and produces a new iterator. + /// An iterator adaptor similar to [`fold()`] that holds internal state and + /// produces a new iterator. /// /// [`fold()`]: #method.fold /// -- cgit 1.4.1-3-g733a5 From 981ac6d332ff19812532a4f64b6dc3f49114f75a Mon Sep 17 00:00:00 2001 From: Luke Jones Date: Mon, 21 Dec 2015 09:53:07 +1300 Subject: Rewrite paragraph in 'match' to be more concise and readable. Start correcting use of ':' in sentences. The colon `:` should be used only when the sentence preceeding it is a complete sentence. If this is not the case, then a `;` should be used; this denotes that the following fragment is a part of the previous fragment. --- src/doc/book/documentation.md | 8 ++++---- src/doc/book/match.md | 18 +++++------------- src/doc/book/patterns.md | 2 +- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/doc/book/documentation.md b/src/doc/book/documentation.md index 0d0fd8cf1d0..fab8f22c6d0 100644 --- a/src/doc/book/documentation.md +++ b/src/doc/book/documentation.md @@ -9,7 +9,7 @@ document your project. The Rust distribution includes a tool, `rustdoc`, that generates documentation. `rustdoc` is also used by Cargo through `cargo doc`. -Documentation can be generated in two ways: from source code, and from +Documentation can be generated in two ways; from source code, and from standalone Markdown files. ## Documenting source code @@ -73,7 +73,7 @@ hello.rs:4 } ``` This [unfortunate error](https://github.com/rust-lang/rust/issues/22547) is -correct: documentation comments apply to the thing after them, and there's +correct; documentation comments apply to the thing after them, and there's nothing after that last comment. [rc-new]: https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.new @@ -385,7 +385,7 @@ error handling. Lets say you want the following, ```rust,ignore /// use std::io; -/// let mut input = String::new(); +/// let mut input = String::new(); /// try!(io::stdin().read_line(&mut input)); ``` @@ -398,7 +398,7 @@ don't return anything so this will give a mismatched types error. /// ``` /// use std::io; /// # fn foo() -> io::Result<()> { -/// let mut input = String::new(); +/// let mut input = String::new(); /// try!(io::stdin().read_line(&mut input)); /// # Ok(()) /// # } diff --git a/src/doc/book/match.md b/src/doc/book/match.md index 113e218883b..ce176e40b90 100644 --- a/src/doc/book/match.md +++ b/src/doc/book/match.md @@ -23,26 +23,18 @@ match x { `match` takes an expression and then branches based on its value. Each ‘arm’ of the branch is of the form `val => expression`. When the value matches, that arm’s expression will be evaluated. It’s called `match` because of the term ‘pattern -matching’, which `match` is an implementation of. There’s an [entire section on +matching’, which `match` is an implementation of. There’s a [separate section on patterns][patterns] that covers all the patterns that are possible here. [patterns]: patterns.html -So what’s the big advantage? Well, there are a few. First of all, `match` -enforces ‘exhaustiveness checking’. Do you see that last arm, the one with the -underscore (`_`)? If we remove that arm, Rust will give us an error: +One of the many advantages of `match` is it enforces ‘exhaustiveness checking’. For example if we remove the last arm with the underscore `_`, the compiler will give us an error: ```text error: non-exhaustive patterns: `_` not covered ``` -In other words, Rust is trying to tell us we forgot a value. Because `x` is an -integer, Rust knows that it can have a number of different values – for -example, `6`. Without the `_`, however, there is no arm that could match, and -so Rust refuses to compile the code. `_` acts like a ‘catch-all arm’. If none -of the other arms match, the arm with `_` will, and since we have this -catch-all arm, we now have an arm for every possible value of `x`, and so our -program will compile successfully. +Rust is telling us that we forgot a value. The compiler infers from `x` that it can have any positive 32bit value; for example 1 to 2,147,483,647. The `_` acts as a 'catch-all', and will catch all possible values that *aren't* specified in an arm of `match`. As you can see with the previous example, we provide `match` arms for integers 1-5, if `x` is 6 or any other value, then it is caught by `_`. `match` is also an expression, which means we can use it on the right-hand side of a `let` binding or directly where an expression is used: @@ -60,7 +52,7 @@ let number = match x { }; ``` -Sometimes it’s a nice way of converting something from one type to another. +Sometimes it’s a nice way of converting something from one type to another; in this example the integers are converted to `String`. # Matching on enums @@ -91,7 +83,7 @@ fn process_message(msg: Message) { Again, the Rust compiler checks exhaustiveness, so it demands that you have a match arm for every variant of the enum. If you leave one off, it -will give you a compile-time error unless you use `_`. +will give you a compile-time error unless you use `_` or provide all possible arms. Unlike the previous uses of `match`, you can’t use the normal `if` statement to do this. You can use the [`if let`][if-let] statement, diff --git a/src/doc/book/patterns.md b/src/doc/book/patterns.md index 43f1bd2529f..6d6044c5300 100644 --- a/src/doc/book/patterns.md +++ b/src/doc/book/patterns.md @@ -7,7 +7,7 @@ on a whirlwind tour of all of the things patterns can do! [bindings]: variable-bindings.html [match]: match.html -A quick refresher: you can match against literals directly, and `_` acts as an +A quick refresher; you can match against literals directly, and `_` acts as an ‘any’ case: ```rust -- cgit 1.4.1-3-g733a5 From fc4bb5f77060b5822f25edbabbdf7a1d48a7f8fe Mon Sep 17 00:00:00 2001 From: Luke Jones Date: Mon, 21 Dec 2015 16:20:20 +1300 Subject: Correct line wrap --- src/doc/book/match.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/doc/book/match.md b/src/doc/book/match.md index ce176e40b90..acffaf4544b 100644 --- a/src/doc/book/match.md +++ b/src/doc/book/match.md @@ -28,13 +28,19 @@ patterns][patterns] that covers all the patterns that are possible here. [patterns]: patterns.html -One of the many advantages of `match` is it enforces ‘exhaustiveness checking’. For example if we remove the last arm with the underscore `_`, the compiler will give us an error: +One of the many advantages of `match` is it enforces ‘exhaustiveness checking’. +For example if we remove the last arm with the underscore `_`, the compiler will +give us an error: ```text error: non-exhaustive patterns: `_` not covered ``` -Rust is telling us that we forgot a value. The compiler infers from `x` that it can have any positive 32bit value; for example 1 to 2,147,483,647. The `_` acts as a 'catch-all', and will catch all possible values that *aren't* specified in an arm of `match`. As you can see with the previous example, we provide `match` arms for integers 1-5, if `x` is 6 or any other value, then it is caught by `_`. +Rust is telling us that we forgot a value. The compiler infers from `x` that it +can have any positive 32bit value; for example 1 to 2,147,483,647. The `_` acts +as a 'catch-all', and will catch all possible values that *aren't* specified in +an arm of `match`. As you can see with the previous example, we provide `match` +arms for integers 1-5, if `x` is 6 or any other value, then it is caught by `_`. `match` is also an expression, which means we can use it on the right-hand side of a `let` binding or directly where an expression is used: @@ -52,7 +58,8 @@ let number = match x { }; ``` -Sometimes it’s a nice way of converting something from one type to another; in this example the integers are converted to `String`. +Sometimes it’s a nice way of converting something from one type to another; in +this example the integers are converted to `String`. # Matching on enums @@ -83,7 +90,8 @@ fn process_message(msg: Message) { Again, the Rust compiler checks exhaustiveness, so it demands that you have a match arm for every variant of the enum. If you leave one off, it -will give you a compile-time error unless you use `_` or provide all possible arms. +will give you a compile-time error unless you use `_` or provide all possible +arms. Unlike the previous uses of `match`, you can’t use the normal `if` statement to do this. You can use the [`if let`][if-let] statement, -- cgit 1.4.1-3-g733a5 From 1bb131cdcad7c954531f51c3f318a92e11000d75 Mon Sep 17 00:00:00 2001 From: Luke Jones Date: Mon, 21 Dec 2015 16:20:56 +1300 Subject: Update patterns.md --- src/doc/book/patterns.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/book/patterns.md b/src/doc/book/patterns.md index 6d6044c5300..43f1bd2529f 100644 --- a/src/doc/book/patterns.md +++ b/src/doc/book/patterns.md @@ -7,7 +7,7 @@ on a whirlwind tour of all of the things patterns can do! [bindings]: variable-bindings.html [match]: match.html -A quick refresher; you can match against literals directly, and `_` acts as an +A quick refresher: you can match against literals directly, and `_` acts as an ‘any’ case: ```rust -- cgit 1.4.1-3-g733a5 From 1522350ecc2e9c9f35ece84919924cb319c0e69e Mon Sep 17 00:00:00 2001 From: Luke Jones Date: Mon, 21 Dec 2015 16:24:17 +1300 Subject: Revert to colon. The text is introducing a list. --- src/doc/book/documentation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/book/documentation.md b/src/doc/book/documentation.md index fab8f22c6d0..86c07f9cf6c 100644 --- a/src/doc/book/documentation.md +++ b/src/doc/book/documentation.md @@ -9,7 +9,7 @@ document your project. The Rust distribution includes a tool, `rustdoc`, that generates documentation. `rustdoc` is also used by Cargo through `cargo doc`. -Documentation can be generated in two ways; from source code, and from +Documentation can be generated in two ways: from source code, and from standalone Markdown files. ## Documenting source code -- cgit 1.4.1-3-g733a5 From 45ecdc83758d26d698572e0f6ca57b9624332db0 Mon Sep 17 00:00:00 2001 From: defyrlt Date: Mon, 21 Dec 2015 16:49:07 +0200 Subject: Removed usage of `drop` from `std::net::UdpSocket` docs Resolves #30507 --- src/libstd/net/udp.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/libstd/net/udp.rs b/src/libstd/net/udp.rs index b212d4d32aa..db49a77d89d 100644 --- a/src/libstd/net/udp.rs +++ b/src/libstd/net/udp.rs @@ -27,18 +27,19 @@ use time::Duration; /// use std::net::UdpSocket; /// /// # fn foo() -> std::io::Result<()> { -/// let mut socket = try!(UdpSocket::bind("127.0.0.1:34254")); +/// { +/// let mut socket = try!(UdpSocket::bind("127.0.0.1:34254")); /// -/// let mut buf = [0; 10]; -/// let (amt, src) = try!(socket.recv_from(&mut buf)); +/// // read from the socket +/// let mut buf = [0; 10]; +/// let (amt, src) = try!(socket.recv_from(&mut buf)); /// -/// // Send a reply to the socket we received data from -/// let buf = &mut buf[..amt]; -/// buf.reverse(); -/// try!(socket.send_to(buf, &src)); -/// -/// drop(socket); // close the socket -/// # Ok(()) +/// // send a reply to the socket we received data from +/// let buf = &mut buf[..amt]; +/// buf.reverse(); +/// try!(socket.send_to(buf, &src)); +/// # Ok(()) +/// } // the socket is closed here /// # } /// ``` #[stable(feature = "rust1", since = "1.0.0")] -- cgit 1.4.1-3-g733a5 From 39630970d7bce424b57f604e4751112e0d396fe0 Mon Sep 17 00:00:00 2001 From: Kai Noda Date: Sat, 26 Dec 2015 02:51:04 +0800 Subject: Correct .gitmodules Use proper URLs as given by Github. So far we relied on redirect by Github which is not guaranteed to work. --- .gitmodules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 83be070b385..eb033f5401d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,7 +13,7 @@ url = https://github.com/rust-lang/jemalloc.git [submodule "src/rust-installer"] path = src/rust-installer - url = https://github.com/rust-lang/rust-installer + url = https://github.com/rust-lang/rust-installer.git [submodule "src/liblibc"] path = src/liblibc - url = https://github.com/rust-lang/libc + url = https://github.com/rust-lang-nursery/libc.git -- cgit 1.4.1-3-g733a5 From e8e649239c67543f2719d0ee045ed87ad81b7382 Mon Sep 17 00:00:00 2001 From: Ori Avtalion Date: Tue, 29 Dec 2015 23:13:23 +0200 Subject: book: Replace "an &mut" with "a mut". Fixes #30568 --- src/doc/book/choosing-your-guarantees.md | 4 ++-- src/doc/book/lifetimes.md | 2 +- src/doc/book/references-and-borrowing.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/doc/book/choosing-your-guarantees.md b/src/doc/book/choosing-your-guarantees.md index d9e92de8d9a..edf5e2ff738 100644 --- a/src/doc/book/choosing-your-guarantees.md +++ b/src/doc/book/choosing-your-guarantees.md @@ -340,11 +340,11 @@ With the former, the `RefCell` is wrapping the `Vec`, so the `Vec` in i mutable. At the same time, there can only be one mutable borrow of the whole `Vec` at a given time. This means that your code cannot simultaneously work on different elements of the vector from different `Rc` handles. However, we are able to push and pop from the `Vec` at will. This is -similar to an `&mut Vec` with the borrow checking done at runtime. +similar to a `&mut Vec` with the borrow checking done at runtime. With the latter, the borrowing is of individual elements, but the overall vector is immutable. Thus, we can independently borrow separate elements, but we cannot push or pop from the vector. This is -similar to an `&mut [T]`[^3], but, again, the borrow checking is at runtime. +similar to a `&mut [T]`[^3], but, again, the borrow checking is at runtime. In concurrent programs, we have a similar situation with `Arc>`, which provides shared mutability and ownership. diff --git a/src/doc/book/lifetimes.md b/src/doc/book/lifetimes.md index 68bbd0c9899..2d418786e9a 100644 --- a/src/doc/book/lifetimes.md +++ b/src/doc/book/lifetimes.md @@ -103,7 +103,7 @@ Then in our parameter list, we use the lifetimes we’ve named: ...(x: &'a i32) ``` -If we wanted an `&mut` reference, we’d do this: +If we wanted a `&mut` reference, we’d do this: ```rust,ignore ...(x: &'a mut i32) diff --git a/src/doc/book/references-and-borrowing.md b/src/doc/book/references-and-borrowing.md index 546636720ca..a172390a021 100644 --- a/src/doc/book/references-and-borrowing.md +++ b/src/doc/book/references-and-borrowing.md @@ -126,7 +126,7 @@ the thing `y` points at. You’ll notice that `x` had to be marked `mut` as well If it wasn’t, we couldn’t take a mutable borrow to an immutable value. You'll also notice we added an asterisk (`*`) in front of `y`, making it `*y`, -this is because `y` is an `&mut` reference. You'll also need to use them for +this is because `y` is a `&mut` reference. You'll also need to use them for accessing the contents of a reference as well. Otherwise, `&mut` references are just like references. There _is_ a large -- cgit 1.4.1-3-g733a5 From 6d388da45f5ef64dc9742bcb31df5e7572b438ac Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Thu, 24 Dec 2015 02:52:27 +0200 Subject: doc: add some links for io::stdio --- src/libstd/io/stdio.rs | 49 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index 120e56d8079..e51453180a7 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -133,14 +133,17 @@ fn handle_ebadf(r: io::Result, default: T) -> io::Result { /// A handle to the standard input stream of a process. /// /// Each handle is a shared reference to a global buffer of input data to this -/// process. A handle can be `lock`'d to gain full access to `BufRead` methods +/// process. A handle can be `lock`'d to gain full access to [BufRead] methods /// (e.g. `.lines()`). Writes to this handle are otherwise locked with respect /// to other writes. /// /// This handle implements the `Read` trait, but beware that concurrent reads /// of `Stdin` must be executed with care. /// -/// Created by the function `io::stdin()`. +/// Created by the [io::stdin] method. +/// +/// [io::stdin]: fn.stdin.html +/// [BufRead]: trait.BufRead.html #[stable(feature = "rust1", since = "1.0.0")] pub struct Stdin { inner: Arc>>>, @@ -148,8 +151,12 @@ pub struct Stdin { /// A locked reference to the `Stdin` handle. /// -/// This handle implements both the `Read` and `BufRead` traits and is -/// constructed via the `lock` method on `Stdin`. +/// This handle implements both the [Read] and [BufRead] traits, and +/// is constructed via the [Stdin::lock] method. +/// +/// [Read]: trait.Read.html +/// [BufRead]: trait.BufRead.html +/// [Stdin::lock]: struct.Stdin.html#method.lock #[stable(feature = "rust1", since = "1.0.0")] pub struct StdinLock<'a> { inner: MutexGuard<'a, BufReader>>, @@ -221,8 +228,11 @@ impl Stdin { /// guard. /// /// The lock is released when the returned lock goes out of scope. The - /// returned guard also implements the `Read` and `BufRead` traits for + /// returned guard also implements the [Read] and [BufRead] traits for /// accessing the underlying data. + /// + /// [Read]: trait.Read.html + /// [BufRead]: trait.BufRead.html #[stable(feature = "rust1", since = "1.0.0")] pub fn lock(&self) -> StdinLock { StdinLock { inner: self.inner.lock().unwrap_or_else(|e| e.into_inner()) } @@ -231,7 +241,9 @@ impl Stdin { /// Locks this handle and reads a line of input into the specified buffer. /// /// For detailed semantics of this method, see the documentation on - /// `BufRead::read_line`. + /// [BufRead::read_line]. + /// + /// [BufRead::read_line]: trait.BufRead.html#method.read_line /// /// # Examples /// @@ -314,7 +326,9 @@ const OUT_MAX: usize = ::usize::MAX; /// output stream. Access is also synchronized via a lock and explicit control /// over locking is available via the `lock` method. /// -/// Created by the function `io::stdout()`. +/// Created by the [io::stdout] method. +/// +/// [io::stdout]: fn.stdout.html #[stable(feature = "rust1", since = "1.0.0")] pub struct Stdout { // FIXME: this should be LineWriter or BufWriter depending on the state of @@ -325,8 +339,11 @@ pub struct Stdout { /// A locked reference to the `Stdout` handle. /// -/// This handle implements the `Write` trait and is constructed via the `lock` -/// method on `Stdout`. +/// This handle implements the [Write] trait, and is constructed via +/// the [Stdout::lock] method. +/// +/// [Write]: trait.Write.html +/// [Stdout::lock]: struct.Stdout.html#method.lock #[stable(feature = "rust1", since = "1.0.0")] pub struct StdoutLock<'a> { inner: ReentrantMutexGuard<'a, RefCell>>>, @@ -336,9 +353,9 @@ pub struct StdoutLock<'a> { /// /// Each handle returned is a reference to a shared global buffer whose access /// is synchronized via a mutex. If you need more explicit control over -/// locking, see the [lock() method][lock]. +/// locking, see the [Stdout::lock] method. /// -/// [lock]: struct.Stdout.html#method.lock +/// [Stdout::lock]: struct.Stdout.html#method.lock /// /// # Examples /// @@ -424,7 +441,9 @@ impl<'a> Write for StdoutLock<'a> { /// A handle to the standard error stream of a process. /// -/// For more information, see `stderr` +/// For more information, see the [io::stderr] method. +/// +/// [io::stderr]: fn.stderr.html #[stable(feature = "rust1", since = "1.0.0")] pub struct Stderr { inner: Arc>>>, @@ -432,8 +451,10 @@ pub struct Stderr { /// A locked reference to the `Stderr` handle. /// -/// This handle implements the `Write` trait and is constructed via the `lock` -/// method on `Stderr`. +/// This handle implements the `Write` trait and is constructed via +/// the [Stderr::lock] method. +/// +/// [Stderr::lock]: struct.Stderr.html#method.lock #[stable(feature = "rust1", since = "1.0.0")] pub struct StderrLock<'a> { inner: ReentrantMutexGuard<'a, RefCell>>, -- cgit 1.4.1-3-g733a5 From a4da9aced97090c594f54e7e5f10bc1d1ada8348 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Wed, 30 Dec 2015 12:41:04 +0200 Subject: doc: add graves --- src/libstd/io/stdio.rs | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index e51453180a7..863e84be093 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -133,17 +133,17 @@ fn handle_ebadf(r: io::Result, default: T) -> io::Result { /// A handle to the standard input stream of a process. /// /// Each handle is a shared reference to a global buffer of input data to this -/// process. A handle can be `lock`'d to gain full access to [BufRead] methods +/// process. A handle can be `lock`'d to gain full access to [`BufRead`] methods /// (e.g. `.lines()`). Writes to this handle are otherwise locked with respect /// to other writes. /// /// This handle implements the `Read` trait, but beware that concurrent reads /// of `Stdin` must be executed with care. /// -/// Created by the [io::stdin] method. +/// Created by the [`io::stdin`] method. /// -/// [io::stdin]: fn.stdin.html -/// [BufRead]: trait.BufRead.html +/// [`io::stdin`]: fn.stdin.html +/// [`BufRead`]: trait.BufRead.html #[stable(feature = "rust1", since = "1.0.0")] pub struct Stdin { inner: Arc>>>, @@ -151,12 +151,12 @@ pub struct Stdin { /// A locked reference to the `Stdin` handle. /// -/// This handle implements both the [Read] and [BufRead] traits, and -/// is constructed via the [Stdin::lock] method. +/// This handle implements both the [`Read`] and [`BufRead`] traits, and +/// is constructed via the [`Stdin::lock`] method. /// -/// [Read]: trait.Read.html -/// [BufRead]: trait.BufRead.html -/// [Stdin::lock]: struct.Stdin.html#method.lock +/// [`Read`]: trait.Read.html +/// [`BufRead`]: trait.BufRead.html +/// [`Stdin::lock`]: struct.Stdin.html#method.lock #[stable(feature = "rust1", since = "1.0.0")] pub struct StdinLock<'a> { inner: MutexGuard<'a, BufReader>>, @@ -166,7 +166,7 @@ pub struct StdinLock<'a> { /// /// Each handle returned is a reference to a shared global buffer whose access /// is synchronized via a mutex. If you need more explicit control over -/// locking, see the [lock() method][lock]. +/// locking, see the [`lock() method`][lock]. /// /// [lock]: struct.Stdin.html#method.lock /// @@ -228,7 +228,7 @@ impl Stdin { /// guard. /// /// The lock is released when the returned lock goes out of scope. The - /// returned guard also implements the [Read] and [BufRead] traits for + /// returned guard also implements the [`Read`] and [`BufRead`] traits for /// accessing the underlying data. /// /// [Read]: trait.Read.html @@ -241,9 +241,9 @@ impl Stdin { /// Locks this handle and reads a line of input into the specified buffer. /// /// For detailed semantics of this method, see the documentation on - /// [BufRead::read_line]. + /// [`BufRead::read_line`]. /// - /// [BufRead::read_line]: trait.BufRead.html#method.read_line + /// [`BufRead::read_line`]: trait.BufRead.html#method.read_line /// /// # Examples /// @@ -326,9 +326,9 @@ const OUT_MAX: usize = ::usize::MAX; /// output stream. Access is also synchronized via a lock and explicit control /// over locking is available via the `lock` method. /// -/// Created by the [io::stdout] method. +/// Created by the [`io::stdout`] method. /// -/// [io::stdout]: fn.stdout.html +/// [`io::stdout`]: fn.stdout.html #[stable(feature = "rust1", since = "1.0.0")] pub struct Stdout { // FIXME: this should be LineWriter or BufWriter depending on the state of @@ -339,11 +339,11 @@ pub struct Stdout { /// A locked reference to the `Stdout` handle. /// -/// This handle implements the [Write] trait, and is constructed via -/// the [Stdout::lock] method. +/// This handle implements the [`Write`] trait, and is constructed via +/// the [`Stdout::lock`] method. /// -/// [Write]: trait.Write.html -/// [Stdout::lock]: struct.Stdout.html#method.lock +/// [`Write`]: trait.Write.html +/// [`Stdout::lock`]: struct.Stdout.html#method.lock #[stable(feature = "rust1", since = "1.0.0")] pub struct StdoutLock<'a> { inner: ReentrantMutexGuard<'a, RefCell>>>, @@ -441,9 +441,9 @@ impl<'a> Write for StdoutLock<'a> { /// A handle to the standard error stream of a process. /// -/// For more information, see the [io::stderr] method. +/// For more information, see the [`io::stderr`] method. /// -/// [io::stderr]: fn.stderr.html +/// [`io::stderr`]: fn.stderr.html #[stable(feature = "rust1", since = "1.0.0")] pub struct Stderr { inner: Arc>>>, @@ -452,9 +452,9 @@ pub struct Stderr { /// A locked reference to the `Stderr` handle. /// /// This handle implements the `Write` trait and is constructed via -/// the [Stderr::lock] method. +/// the [`Stderr::lock`] method. /// -/// [Stderr::lock]: struct.Stderr.html#method.lock +/// [`Stderr::lock`]: struct.Stderr.html#method.lock #[stable(feature = "rust1", since = "1.0.0")] pub struct StderrLock<'a> { inner: ReentrantMutexGuard<'a, RefCell>>, -- cgit 1.4.1-3-g733a5