about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorJeffrey Seyfried <jeffrey.seyfried@gmail.com>2016-05-24 06:12:54 +0000
committerJeffrey Seyfried <jeffrey.seyfried@gmail.com>2016-05-24 11:48:00 +0000
commite9c0283369bbb9879e0be2440d77f23d806b5537 (patch)
tree9162e371db6c47669b5f2553b9e7ea365f3c9ce8 /src/libsyntax/ext
parent3c421ac67ef55541de73689f2f6bbabd7ddb0a9a (diff)
downloadrust-e9c0283369bbb9879e0be2440d77f23d806b5537.tar.gz
rust-e9c0283369bbb9879e0be2440d77f23d806b5537.zip
Add comments and fix a nit
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/expand.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index df1bbf5f26e..596faac3588 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -35,10 +35,18 @@ use std_inject;
 use std::collections::HashSet;
 use std::env;
 
+// A trait for AST nodes and AST node lists into which macro invocations may expand.
 trait MacroGenerable: Sized {
+    // Expand the given MacResult using its appropriate `make_*` method.
     fn make_with<'a>(result: Box<MacResult + 'a>) -> Option<Self>;
+
+    // Fold this node or list of nodes using the given folder.
     fn fold_with<F: Folder>(self, folder: &mut F) -> Self;
+
+    // Return a placeholder expansion to allow compilation to continue after an erroring expansion.
     fn dummy(span: Span) -> Self;
+
+    // The user-friendly name of the node type (e.g. "expression", "item", etc.) for diagnostics.
     fn kind_name() -> &'static str;
 }
 
@@ -207,7 +215,7 @@ fn expand_mac_invoc<T>(mac: ast::Mac, ident: Option<Ident>, attrs: Vec<ast::Attr
             return None;
         };
 
-        let ident = ident.unwrap_or(Ident::with_empty_ctxt(keywords::Invalid.name()));
+        let ident = ident.unwrap_or(keywords::Invalid.ident());
         match *extension {
             NormalTT(ref expandfun, exp_span, allow_internal_unstable) => {
                 if ident.name != keywords::Invalid.name() {