From e9c0283369bbb9879e0be2440d77f23d806b5537 Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Tue, 24 May 2016 06:12:54 +0000 Subject: [PATCH] Add comments and fix a nit --- src/libsyntax/ext/expand.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index df1bbf5f26ecd..596faac35882a 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) -> Option; + + // Fold this node or list of nodes using the given folder. fn fold_with(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(mac: ast::Mac, ident: Option, attrs: Vec { if ident.name != keywords::Invalid.name() {