Demonstrate include! with Rust code, not just a string slice literal.

This commit is contained in:
Corey Farwell 2017-08-11 23:45:48 -04:00
parent 8da3ff3fcc
commit ea6f0f060c

View File

@ -545,23 +545,28 @@ macro_rules! cfg { ($($cfg:tt)*) => ({ /* compiler built-in */ }) }
/// Assume there are two files in the same directory with the following
/// contents:
///
/// File 'my_str.in':
/// File 'monkeys.in':
///
/// ```ignore (only-for-syntax-highlight)
/// "Hello World!"
/// ['🙈', '🙊', '🙉']
/// .iter()
/// .cycle()
/// .take(6)
/// .collect::<String>()
/// ```
///
/// File 'main.rs':
///
/// ```ignore (cannot-doctest-external-file-dependency)
/// fn main() {
/// let my_str = include!("my_str.in");
/// println!("{}", my_str);
/// let my_string = include!("monkeys.in");
/// assert_eq!("🙈🙊🙉🙈🙊🙉", my_string);
/// println!("{}", my_string);
/// }
/// ```
///
/// Compiling 'main.rs' and running the resulting binary will print "Hello
/// World!".
/// Compiling 'main.rs' and running the resulting binary will print
/// "🙈🙊🙉🙈🙊🙉".
#[stable(feature = "rust1", since = "1.0.0")]
#[macro_export]
macro_rules! include { ($file:expr) => ({ /* compiler built-in */ }) }