Skip to content

Commit e9c0283

Browse files
committed
Add comments and fix a nit
1 parent 3c421ac commit e9c0283

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/libsyntax/ext/expand.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,18 @@ use std_inject;
3535
use std::collections::HashSet;
3636
use std::env;
3737

38+
// A trait for AST nodes and AST node lists into which macro invocations may expand.
3839
trait MacroGenerable: Sized {
40+
// Expand the given MacResult using its appropriate `make_*` method.
3941
fn make_with<'a>(result: Box<MacResult + 'a>) -> Option<Self>;
42+
43+
// Fold this node or list of nodes using the given folder.
4044
fn fold_with<F: Folder>(self, folder: &mut F) -> Self;
45+
46+
// Return a placeholder expansion to allow compilation to continue after an erroring expansion.
4147
fn dummy(span: Span) -> Self;
48+
49+
// The user-friendly name of the node type (e.g. "expression", "item", etc.) for diagnostics.
4250
fn kind_name() -> &'static str;
4351
}
4452

@@ -207,7 +215,7 @@ fn expand_mac_invoc<T>(mac: ast::Mac, ident: Option<Ident>, attrs: Vec<ast::Attr
207215
return None;
208216
};
209217

210-
let ident = ident.unwrap_or(Ident::with_empty_ctxt(keywords::Invalid.name()));
218+
let ident = ident.unwrap_or(keywords::Invalid.ident());
211219
match *extension {
212220
NormalTT(ref expandfun, exp_span, allow_internal_unstable) => {
213221
if ident.name != keywords::Invalid.name() {

0 commit comments

Comments
 (0)