about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorNODA, Kai <nodakai@gmail.com>2016-02-11 00:55:47 +0800
committerNODA, Kai <nodakai@gmail.com>2016-02-11 04:14:03 +0800
commitcec158b6b7c488c93f16bbe07b6082d5e4f2f7b1 (patch)
treeeacba0f376d23ec208ad30111a66842c011bdc62 /src/libstd
parent052b3fd4a0c484638a8e8b30f9b628abfaeffde4 (diff)
downloadrust-cec158b6b7c488c93f16bbe07b6082d5e4f2f7b1.tar.gz
rust-cec158b6b7c488c93f16bbe07b6082d5e4f2f7b1.zip
doc: concat_idents! macro: more on its limitations.
Signed-off-by: NODA, Kai <nodakai@gmail.com>
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/macros.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs
index b7afd12d8e5..d241cd032ed 100644
--- a/src/libstd/macros.rs
+++ b/src/libstd/macros.rs
@@ -269,9 +269,10 @@ pub mod builtin {
     /// This macro takes any number of comma-separated identifiers, and
     /// concatenates them all into one, yielding an expression which is a new
     /// identifier. Note that hygiene makes it such that this macro cannot
-    /// capture local variables, and macros are only allowed in item,
-    /// statement or expression position, meaning this macro may be difficult to
-    /// use in some situations.
+    /// capture local variables. Also, as a general rule, macros are only
+    /// allowed in item, statement or expression position. That means while
+    /// you may use this macro for referring to existing variables, functions or
+    /// modules etc, you cannot define a new one with it.
     ///
     /// # Examples
     ///
@@ -283,6 +284,8 @@ pub mod builtin {
     ///
     /// let f = concat_idents!(foo, bar);
     /// println!("{}", f());
+    ///
+    /// // fn concat_idents!(new, fun, name) { } // not usable in this way!
     /// # }
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]