Skip to content

Commit

Permalink
doc: concat_idents! macro: more on its limitations.
Browse files Browse the repository at this point in the history
Signed-off-by: NODA, Kai <nodakai@gmail.com>
  • Loading branch information
nodakai committed Feb 10, 2016
1 parent 052b3fd commit cec158b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/libstd/macros.rs
Expand Up @@ -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
///
Expand All @@ -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")]
Expand Down

0 comments on commit cec158b

Please sign in to comment.