Skip to content

Commit ab792ab

Browse files
committed
Auto merge of #28047 - steveklabnik:doc_print, r=alexcrichton
2 parents 6f28232 + d9819b7 commit ab792ab

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/libstd/macros.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,26 @@ macro_rules! panic {
6767
/// Note that stdout is frequently line-buffered by default so it may be
6868
/// necessary to use `io::stdout().flush()` to ensure the output is emitted
6969
/// immediately.
70+
///
71+
/// # Examples
72+
///
73+
/// ```
74+
/// use std::io::{self, Write};
75+
///
76+
/// print!("this ");
77+
/// print!("will ");
78+
/// print!("be ");
79+
/// print!("on ");
80+
/// print!("the ");
81+
/// print!("same ");
82+
/// print!("line ");
83+
///
84+
/// io::stdout().flush().unwrap();
85+
///
86+
/// print!("this string has a newline, why not choose println! instead?\n");
87+
///
88+
/// io::stdout().flush().unwrap();
89+
/// ```
7090
#[macro_export]
7191
#[stable(feature = "rust1", since = "1.0.0")]
7292
#[allow_internal_unstable]

0 commit comments

Comments
 (0)