Skip to content

Commit 34d6348

Browse files
committed
---
yaml --- r: 63700 b: refs/heads/snap-stage3 c: 73e3dbf h: refs/heads/master v: v3
1 parent 937fea7 commit 34d6348

File tree

5 files changed

+289
-270
lines changed

5 files changed

+289
-270
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: a30ab764e10232d8e9c1f9282c33b65ca9ef7daf
4+
refs/heads/snap-stage3: 73e3dbf9c082659d9f7aa9281ef4af4080ed019d
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/driver/driver.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,22 @@ pub fn compile_rest(sess: Session,
188188
*sess.building_library = session::building_library(
189189
sess.opts.crate_type, crate_opt.unwrap(), sess.opts.test);
190190

191+
// strip before expansion to allow macros to depend on
192+
// configuration variables e.g/ in
193+
//
194+
// #[macro_escape] #[cfg(foo)]
195+
// mod bar { macro_rules! baz!(() => {{}}) }
196+
//
197+
// baz! should not use this definition unless foo is enabled.
198+
crate_opt = Some(time(time_passes, ~"configuration 1", ||
199+
front::config::strip_unconfigured_items(crate_opt.unwrap())));
200+
191201
crate_opt = Some(time(time_passes, ~"expansion", ||
192202
syntax::ext::expand::expand_crate(sess.parse_sess, copy cfg,
193203
crate_opt.unwrap())));
194204

195-
crate_opt = Some(time(time_passes, ~"configuration", ||
205+
// strip again, in case expansion added anything with a #[cfg].
206+
crate_opt = Some(time(time_passes, ~"configuration 2", ||
196207
front::config::strip_unconfigured_items(crate_opt.unwrap())));
197208

198209
crate_opt = Some(time(time_passes, ~"maybe building test harness", ||

0 commit comments

Comments
 (0)