about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2016-12-18 11:30:56 -0800
committerCorey Farwell <coreyf@rwell.org>2016-12-21 10:44:07 -0800
commit8a472a55677959639a92d359a23f5e075cd3cbce (patch)
treeff60c232ba404ba69faca4e9ed7c74ce3e3ce12e /src
parent1b38776c1f68c6fd47c1b2f7b7974efc7dd64901 (diff)
downloadrust-8a472a55677959639a92d359a23f5e075cd3cbce.tar.gz
rust-8a472a55677959639a92d359a23f5e075cd3cbce.zip
Add a more complete doc example for 'include' macro.
Diffstat (limited to 'src')
-rw-r--r--src/libstd/macros.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs
index 0ce6b0a9431..9908afd900b 100644
--- a/src/libstd/macros.rs
+++ b/src/libstd/macros.rs
@@ -470,11 +470,26 @@ pub mod builtin {
     ///
     /// # Examples
     ///
+    /// Assume there are two files in the same directory with the following
+    /// contents:
+    ///
+    /// File 'my_str.in':
+    ///
     /// ```ignore
-    /// fn foo() {
-    ///     include!("/path/to/a/file")
+    /// "Hello World!"
+    /// ```
+    ///
+    /// File 'main.rs':
+    ///
+    /// ```ignore
+    /// fn main() {
+    ///     let my_str = include!("my_str.in");
+    ///     println!("{}", my_str);
     /// }
     /// ```
+    ///
+    /// Compiling 'main.rs' and running the resulting binary will print "Hello
+    /// World!".
     #[stable(feature = "rust1", since = "1.0.0")]
     #[macro_export]
     macro_rules! include { ($file:expr) => ({ /* compiler built-in */ }) }