Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Commit

Permalink
Auto merge of #71 - dtolnay:cfg, r=erickt
Browse files Browse the repository at this point in the history
Reimplement derive to work with cfg_attr

Fixes serde-rs/serde#148.

The implementation expands `cfg_attr` and `derive` in-line during decorator expansion rather than as pre/post-expansion passes. I think this is a simpler and more correct design, but at the expense of being more invasive into the libsyntax code.
  • Loading branch information
homu committed Jun 16, 2016
2 parents 4f96f88 + b57c45d commit 50acfd9
Show file tree
Hide file tree
Showing 7 changed files with 206 additions and 378 deletions.
3 changes: 0 additions & 3 deletions syntex/src/lib.rs
@@ -1,7 +1,5 @@
extern crate syntex_syntax;

mod squash_derive;

use std::fs::File;
use std::io::{self, Write};
use std::path::Path;
Expand Down Expand Up @@ -175,7 +173,6 @@ impl Registry {
let ecx = ExtCtxt::new(&sess, cfg, ecfg, &mut gated_cfgs, &mut macro_loader);

let (krate, _) = expand::expand_crate(ecx, self.syntax_exts, krate);
let krate = squash_derive::squash_derive(krate);

let krate = self.post_expansion_passes.iter()
.fold(krate, |krate, f| (f)(krate));
Expand Down
219 changes: 0 additions & 219 deletions syntex/src/squash_derive.rs

This file was deleted.

2 changes: 0 additions & 2 deletions syntex_syntax/src/ext/base.rs
Expand Up @@ -469,8 +469,6 @@ fn initial_syntax_expander_table<'feat>(ecfg: &expand::ExpansionConfig<'feat>)
syntax_expanders.insert(intern("macro_rules"), MacroRulesTT);
*/

ext::deriving::register_all(&mut syntax_expanders);

if ecfg.enable_quotes() {
// Quasi-quoting expanders
syntax_expanders.insert(intern("quote_tokens"),
Expand Down

0 comments on commit 50acfd9

Please sign in to comment.