about summary refs log tree commit diff
path: root/src/libsyntax/ext/base.rs
diff options
context:
space:
mode:
authorKeegan McAllister <kmcallister@mozilla.com>2015-03-06 13:15:54 -0800
committerKeegan McAllister <kmcallister@mozilla.com>2015-03-06 18:20:16 -0800
commit491054f08e2aaaa8438f1a9943f115dad9da1c6b (patch)
tree7ab7e4dfd5b60e7d3d3aedb501065da17bc35204 /src/libsyntax/ext/base.rs
parente60e6f0693adfd03340dff31023c7517dc3af1b5 (diff)
downloadrust-491054f08e2aaaa8438f1a9943f115dad9da1c6b.tar.gz
rust-491054f08e2aaaa8438f1a9943f115dad9da1c6b.zip
Make #[derive(Anything)] into sugar for #[derive_Anything]
This is a hack, but I don't think we can do much better as long as `derive` is
running at the syntax expansion phase.

If the custom_derive feature gate is enabled, this works with user-defined
traits and syntax extensions. Without the gate, you can't use e.g. #[derive_Clone]
directly, so this does not change the stable language.

This commit also cleans up the deriving code somewhat, and forbids some
previously-meaningless attribute syntax. For this reason it's technically a

    [breaking-change]
Diffstat (limited to 'src/libsyntax/ext/base.rs')
-rw-r--r--src/libsyntax/ext/base.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index 5513b44235d..8aeafe419da 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -491,10 +491,8 @@ fn initial_syntax_expander_table<'feat>(ecfg: &expand::ExpansionConfig<'feat>)
     syntax_expanders.insert(intern("log_syntax"),
                             builtin_normal_expander(
                                     ext::log_syntax::expand_syntax_ext));
-    syntax_expanders.insert(intern("derive"),
-                            Decorator(Box::new(ext::deriving::expand_meta_derive)));
-    syntax_expanders.insert(intern("deriving"),
-                            Decorator(Box::new(ext::deriving::expand_deprecated_deriving)));
+
+    ext::deriving::register_all(&mut syntax_expanders);
 
     if ecfg.enable_quotes() {
         // Quasi-quoting expanders