Skip to content

Commit ea6f0f0

Browse files
committed
Demonstrate include! with Rust code, not just a string slice literal.
1 parent 8da3ff3 commit ea6f0f0

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/libstd/macros.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -545,23 +545,28 @@ pub mod builtin {
545545
/// Assume there are two files in the same directory with the following
546546
/// contents:
547547
///
548-
/// File 'my_str.in':
548+
/// File 'monkeys.in':
549549
///
550550
/// ```ignore (only-for-syntax-highlight)
551-
/// "Hello World!"
551+
/// ['🙈', '🙊', '🙉']
552+
/// .iter()
553+
/// .cycle()
554+
/// .take(6)
555+
/// .collect::<String>()
552556
/// ```
553557
///
554558
/// File 'main.rs':
555559
///
556560
/// ```ignore (cannot-doctest-external-file-dependency)
557561
/// fn main() {
558-
/// let my_str = include!("my_str.in");
559-
/// println!("{}", my_str);
562+
/// let my_string = include!("monkeys.in");
563+
/// assert_eq!("🙈🙊🙉🙈🙊🙉", my_string);
564+
/// println!("{}", my_string);
560565
/// }
561566
/// ```
562567
///
563-
/// Compiling 'main.rs' and running the resulting binary will print "Hello
564-
/// World!".
568+
/// Compiling 'main.rs' and running the resulting binary will print
569+
/// "🙈🙊🙉🙈🙊🙉".
565570
#[stable(feature = "rust1", since = "1.0.0")]
566571
#[macro_export]
567572
macro_rules! include { ($file:expr) => ({ /* compiler built-in */ }) }

0 commit comments

Comments
 (0)