Skip to content

Commit 2cac14e

Browse files
authored
Rollup merge of rust-lang#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)
2 parents 2f84fb5 + 2f51f67 commit 2cac14e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/liballoc/fmt.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@
236236
//! writeln! // same as write but appends a newline
237237
//! print! // the format string is printed to the standard output
238238
//! println! // same as print but appends a newline
239+
//! eprint! // the format string is printed to the standard error
240+
//! eprintln! // same as eprint but appends a newline
239241
//! format_args! // described below.
240242
//! ```
241243
//!
@@ -264,6 +266,11 @@
264266
//! print!("Hello {}!", "world");
265267
//! println!("I have a newline {}", "character at the end");
266268
//! ```
269+
//! ### `eprint!`
270+
//!
271+
//! The [`eprint!`] and [`eprintln!`] macros are identical to
272+
//! [`print!`] and [`println!`], respectively, except they emit their
273+
//! output to stderr.
267274
//!
268275
//! ### `format_args!`
269276
//!
@@ -490,7 +497,10 @@
490497
//! [`writeln!`]: ../../std/macro.writeln.html
491498
//! [`write_fmt`]: ../../std/io/trait.Write.html#method.write_fmt
492499
//! [`std::io::Write`]: ../../std/io/trait.Write.html
500+
//! [`print!`]: ../../std/macro.print.html
493501
//! [`println!`]: ../../std/macro.println.html
502+
//! [`eprint!`]: ../../std/macro.eprint.html
503+
//! [`eprintln!`]: ../../std/macro.eprintln.html
494504
//! [`write!`]: ../../std/macro.write.html
495505
//! [`format_args!`]: ../../std/macro.format_args.html
496506
//! [`fmt::Arguments`]: struct.Arguments.html

0 commit comments

Comments
 (0)