From 9ee9c49cb4823c5bddbd9ec1ece6dfafa9e833ea Mon Sep 17 00:00:00 2001 From: John Clements Date: Mon, 7 Jul 2014 09:54:08 -0700 Subject: introducing let-syntax The let-syntax expander is different in that it doesn't apply a mark to its token trees before expansion. This is used for macro_rules, and it's because macro_rules is essentially MTWT's let-syntax. You don't want to mark before expand sees let-syntax, because there's no "after" syntax to mark again. In some sense, the cleaner approach might be to introduce a new AST node that macro_rules expands into; this would make it clearer that the expansion of a macro is distinct from the addition of a new macro binding. This should work for now, though... --- src/librustc/plugin/registry.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/librustc/plugin') diff --git a/src/librustc/plugin/registry.rs b/src/librustc/plugin/registry.rs index 587bedd502e..2581ba51c2e 100644 --- a/src/librustc/plugin/registry.rs +++ b/src/librustc/plugin/registry.rs @@ -13,7 +13,7 @@ use lint::LintPassObject; use syntax::ext::base::{SyntaxExtension, NamedSyntaxExtension, NormalTT}; -use syntax::ext::base::{IdentTT, ItemDecorator, ItemModifier, BasicMacroExpander}; +use syntax::ext::base::{IdentTT, LetSyntaxTT, ItemDecorator, ItemModifier, BasicMacroExpander}; use syntax::ext::base::{MacroExpanderFn}; use syntax::codemap::Span; use syntax::parse::token; @@ -57,6 +57,8 @@ impl Registry { IdentTT(ext, _) => IdentTT(ext, Some(self.krate_span)), ItemDecorator(ext) => ItemDecorator(ext), ItemModifier(ext) => ItemModifier(ext), + // there's probably a nicer way to signal this: + LetSyntaxTT(_, _) => fail!("can't register a new LetSyntax!"), })); } -- cgit 1.4.1-3-g733a5