about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2017-11-26 15:01:34 +0800
committerGitHub <noreply@github.com>2017-11-26 15:01:34 +0800
commit2cac14e2f99b22cefb2fe07607f1eb0cee920d6a (patch)
treee2556397d725ec3b890e33cc5eb742dac371b95f /src
parent2f84fb5cc1ac5f04bdf5a281997e02bcf4fc18d9 (diff)
parent2f51f671c46efe91e803de8ab02fc5d379c089a8 (diff)
downloadrust-2cac14e2f99b22cefb2fe07607f1eb0cee920d6a.tar.gz
rust-2cac14e2f99b22cefb2fe07607f1eb0cee920d6a.zip
Rollup merge of #46201 - davidalber:eprint-in-fmt-doc, r=frewsxcv
Adding `eprint*!` to the list of macros in the `format!` family

The `eprint!` and `eprintln!` macros were added in 7612727. The `std::fmt` documentation does not mention these macros next to `print!` and `println!` in the [Related macros](https://doc.rust-lang.org/std/fmt/#related-macros) section, and I did not find evidence that this omission was deliberate. This PR adds such documentation.

The first modification is to add `eprint!` and `eprintln!` to the list of related macros in the `format!` family. This is how it appears with this change:

![image](https://user-images.githubusercontent.com/933552/33159527-67056caa-cfc8-11e7-8b7d-4224ef2fce4e.png)

The second modification adds a sub-section for `eprint!` and `eprintln!`. Here is how the new section appears:

![image](https://user-images.githubusercontent.com/933552/33159541-97d03bee-cfc8-11e7-8b95-4d3632b5ab7b.png)
Diffstat (limited to 'src')
-rw-r--r--src/liballoc/fmt.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/liballoc/fmt.rs b/src/liballoc/fmt.rs
index 7148a1143fd..a092bfb3b0a 100644
--- a/src/liballoc/fmt.rs
+++ b/src/liballoc/fmt.rs
@@ -236,6 +236,8 @@
 //! writeln!     // same as write but appends a newline
 //! print!       // the format string is printed to the standard output
 //! println!     // same as print but appends a newline
+//! eprint!      // the format string is printed to the standard error
+//! eprintln!    // same as eprint but appends a newline
 //! format_args! // described below.
 //! ```
 //!
@@ -264,6 +266,11 @@
 //! print!("Hello {}!", "world");
 //! println!("I have a newline {}", "character at the end");
 //! ```
+//! ### `eprint!`
+//!
+//! The [`eprint!`] and [`eprintln!`] macros are identical to
+//! [`print!`] and [`println!`], respectively, except they emit their
+//! output to stderr.
 //!
 //! ### `format_args!`
 //!
@@ -490,7 +497,10 @@
 //! [`writeln!`]: ../../std/macro.writeln.html
 //! [`write_fmt`]: ../../std/io/trait.Write.html#method.write_fmt
 //! [`std::io::Write`]: ../../std/io/trait.Write.html
+//! [`print!`]: ../../std/macro.print.html
 //! [`println!`]: ../../std/macro.println.html
+//! [`eprint!`]: ../../std/macro.eprint.html
+//! [`eprintln!`]: ../../std/macro.eprintln.html
 //! [`write!`]: ../../std/macro.write.html
 //! [`format_args!`]: ../../std/macro.format_args.html
 //! [`fmt::Arguments`]: struct.Arguments.html