@@ -461,9 +461,26 @@ pub mod builtin {
461
461
///
462
462
/// # Examples
463
463
///
464
+ /// Assume there are two files in the same directory with the following
465
+ /// contents:
466
+ ///
467
+ /// File 'spanish.in':
468
+ ///
469
+ /// ```text
470
+ /// adiΓ³s
471
+ /// ```
472
+ ///
473
+ /// File 'main.rs':
474
+ ///
464
475
/// ```ignore (cannot-doctest-external-file-dependency)
465
- /// let secret_key = include_str!("secret-key.ascii");
476
+ /// fn main() {
477
+ /// let my_str = include_str!("spanish.in");
478
+ /// assert_eq!(my_str, "adiΓ³s\n");
479
+ /// print!("{}", my_str);
480
+ /// }
466
481
/// ```
482
+ ///
483
+ /// Compiling 'main.rs' and running the resulting binary will print "adiΓ³s".
467
484
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
468
485
#[ macro_export]
469
486
macro_rules! include_str { ( $file: expr) => ( { /* compiler built-in */ } ) }
@@ -478,9 +495,26 @@ pub mod builtin {
478
495
///
479
496
/// # Examples
480
497
///
498
+ /// Assume there are two files in the same directory with the following
499
+ /// contents:
500
+ ///
501
+ /// File 'spanish.in':
502
+ ///
503
+ /// ```text
504
+ /// adiΓ³s
505
+ /// ```
506
+ ///
507
+ /// File 'main.rs':
508
+ ///
481
509
/// ```ignore (cannot-doctest-external-file-dependency)
482
- /// let secret_key = include_bytes!("secret-key.bin");
510
+ /// fn main() {
511
+ /// let bytes = include_bytes!("spanish.in");
512
+ /// assert_eq!(bytes, b"adi\xc3\xb3s\n");
513
+ /// print!("{}", String::from_utf8_lossy(bytes));
514
+ /// }
483
515
/// ```
516
+ ///
517
+ /// Compiling 'main.rs' and running the resulting binary will print "adiΓ³s".
484
518
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
485
519
#[ macro_export]
486
520
macro_rules! include_bytes { ( $file: expr) => ( { /* compiler built-in */ } ) }
@@ -545,23 +579,28 @@ pub mod builtin {
545
579
/// Assume there are two files in the same directory with the following
546
580
/// contents:
547
581
///
548
- /// File 'my_str .in':
582
+ /// File 'monkeys .in':
549
583
///
550
584
/// ```ignore (only-for-syntax-highlight)
551
- /// "Hello World!"
585
+ /// ['π', 'π', 'π']
586
+ /// .iter()
587
+ /// .cycle()
588
+ /// .take(6)
589
+ /// .collect::<String>()
552
590
/// ```
553
591
///
554
592
/// File 'main.rs':
555
593
///
556
594
/// ```ignore (cannot-doctest-external-file-dependency)
557
595
/// fn main() {
558
- /// let my_str = include!("my_str.in");
559
- /// println!("{}", my_str);
596
+ /// let my_string = include!("monkeys.in");
597
+ /// assert_eq!("ππππππ", my_string);
598
+ /// println!("{}", my_string);
560
599
/// }
561
600
/// ```
562
601
///
563
- /// Compiling 'main.rs' and running the resulting binary will print "Hello
564
- /// World! ".
602
+ /// Compiling 'main.rs' and running the resulting binary will print
603
+ /// "ππππππ ".
565
604
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
566
605
#[ macro_export]
567
606
macro_rules! include { ( $file: expr) => ( { /* compiler built-in */ } ) }
0 commit comments